Opened 3 years ago

Last modified 18 months ago

#14855 new defect (bug)

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

Reported by: hakre Owned by:
Priority: normal Milestone: Future Release
Component: Users Version: 3.1
Severity: normal Keywords: has-patch
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 3 years ago.
14855.2.patch (862 bytes) - added by hakre 3 years ago.

Download all attachments as: .zip

Change History (8)

hakre3 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.

Related: #7509

comment:3 follow-up: ↓ 4   nacin3 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.

hakre3 years ago

comment:4 in reply to: ↑ 3   hakre3 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.

  • 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.

Given #15458, is this still an issue?

Note: See TracTickets for help on using tickets.