WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 months ago

Last modified 4 months ago

#14855 closed defect (bug) (invalid)

WP_User misses values for some default properties (nickname, rich_editing)

Reported by: hakre Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.1
Component: Users Keywords: has-patch
Focuses: Cc:

Description

WP_User is expected to have default properties like last_name, ID etc.

At least two of them are missing in the class definition:

  1. nickname
  2. rich_editing

The attached patch adds them.

/wp-admin/user-edit.php does Warnings / Notices if the properties are not set.

This is the case for users in the database that have not set these fields as meta data.

Attachments (2)

14855.patch (657 bytes) - added by hakre 4 years ago.
14855.2.patch (862 bytes) - added by hakre 4 years ago.

Download all attachments as: .zip

Change History (10)

@hakre4 years ago

comment:1 @hakre4 years ago

  • Summary changed from WP_User misses values for some default proerties (nickname, rich_editing) to WP_User misses values for some default properties (nickname, rich_editing)
  • Version set to 3.1

This adds the two properties and their default values. I was unsure on the version with which those properties were introduced so I chooses 3.1.0 for now.

I was not sure about rich_editing default, so I choosed false. I was not able to clarify it's default value, so this must be reviewed in case it's important. I don't think so.

comment:2 @hakre4 years ago

Related: #7509

comment:3 follow-up: @nacin4 years ago

For the default: http://core.trac.wordpress.org/browser/tags/3.0.1/wp-includes/registration.php#L166

Also, how were these users created? These should be created on registration.

@hakre4 years ago

comment:4 in reply to: ↑ 3 @hakre4 years ago

Replying to nacin:

For the default: http://core.trac.wordpress.org/browser/tags/3.0.1/wp-includes/registration.php#L166

Updated to defaults, added $user_login because it contains the default value for the notice giving $nickname according to the code you linked.

Also, how were these users created? These should be created on registration.

These users were created by inserting them into the database directly by providing only the required subset of user-metas to make WordPress them able to logon.

So those users are directly loaded out of the DB, identified as being valid and are even run through the sanitization functions but still miss those values which are expected to be existing on user-edit.php giving notices there.

It might make sense to add something in the sanitization as well, so to make validate_username() and sanitize_user_object() working together more closely.

comment:5 @nacin4 years ago

  • Milestone changed from Awaiting Review to Future Release

This seems fine. We should check if others need to be added as well, like admin_color, show_admin_bar_front, and show_admin_bar_admin.

comment:6 @scribu3 years ago

Given #15458, is this still an issue?

comment:7 @chriscct74 months ago

  • Resolution set to invalid
  • Status changed from new to closed

This isn't an issue anymore because of #15458

comment:8 @SergeyBiryukov4 months ago

  • Milestone Future Release deleted
Note: See TracTickets for help on using tickets.