Make WordPress Core

Opened 10 years ago

Closed 9 years ago

Last modified 9 years ago

#29120 closed defect (bug) (fixed)

user.php inconsistency between _get_additional_user_keys() and wp_insert_user() regarding first_name and last_name

Reported by: martha_camellia's profile martha_camellia Owned by: drewapicture's profile DrewAPicture
Milestone: 4.4 Priority: normal
Severity: normal Version: 3.9.1
Component: Login and Registration Keywords:
Focuses: docs Cc:

Description

file: wp/wp-includes/user.php

Found while trying to use user_register action on new account creation.

According to the code comment, function _get_additional_user_keys() does this: "Return a list of meta keys that wp_insert_user() is supposed to set." Included in it's return data are "first_name" and "last_name". However, the wp_insert_user() function does not set those values, although it does use them.

I am not sure whether wp_insert_user() is supposed to set first_name and last_name or not. Wish it would :-)

Change History (7)

This ticket was mentioned in Slack in #core by jorbin. View the logs.


9 years ago

#2 @jorbin
9 years ago

  • Focuses docs added
  • Keywords needs-patch added

Thanks for the report martha_camellia and sorry it took so long for someone to respond.

I think we should clarify the documentation of _get_additional_user_keys() to make it clear that some of the user data may be empty based on what has previously been set.

#3 @DrewAPicture
9 years ago

  • Keywords needs-patch removed
  • Milestone changed from Awaiting Review to 4.4

#4 follow-up: @DrewAPicture
9 years ago

  • Owner set to DrewAPicture
  • Resolution set to fixed
  • Status changed from new to closed

In 33687:

Docs: Clarify the DocBlock summary and add a description and return description for _get_additional_user_keys().

As noted in the description, returned keys being set is dependent on the existence of those keys in user meta at the point where _get_additional_user_keys() is called in wp_update_user().

Fixes #29120.

#5 in reply to: ↑ 4 ; follow-up: @dimadin
9 years ago

Replying to DrewAPicture:

That description right now is not clear enough and I think that you made some mistake. Right now:

Values actually keys returned via this function are dependent on the presence of those keys in the user meta data.

Maybe something like this:

Values that are returned via this function are dependent on the presence of those keys in the user meta data.

#6 in reply to: ↑ 5 @DrewAPicture
9 years ago

Replying to dimadin:

Replying to DrewAPicture:

That description right now is not clear enough and I think that you made some mistake. Right now:

Values actually keys returned via this function are dependent on the presence of those keys in the user meta data.

Maybe something like this:

Values that are returned via this function are dependent on the presence of those keys in the user meta data.

Yep. Typo. Good catch.

#7 @DrewAPicture
9 years ago

In 33690:

Docs: Fix a typo in the DocBlock description for _get_additional_user_keys(), introduced in [33687].

Props dimadin
See #29120.

Note: See TracTickets for help on using tickets.