Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#31513 closed defect (bug) (fixed)

Wrong description in DocBlock of function wp_insert_user()

Reported by: floriansimeth Owned by: DrewAPicture
Priority: normal Milestone: 4.2
Component: Users Version: 4.1
Severity: normal Keywords:
Cc: Focuses: docs

Description

Hey WP-Community,

I hope you all doing good.

I've found out that the variable name in the DocBlock of the wp_insert_user() in file /wp-includes/user.php (line 1689) is wrong.

The parameter $date_registered should be renamed to $user_registered. I don't know really why this parameter is called $user_registered as the value gets saved into the database table cell named date_registered.

I've tested that

wp_insert_user( array(
	'date_registered' => '2010-12-05 10:00:01',
	'user_pass'       => 'test',
	'user_login'      => 'testperson',
) );

will not work whereas

wp_insert_user( array(
	'user_registered' => '2010-12-05 10:00:01',
	'user_pass'       => 'test',
	'user_login'      => 'testperson',
) );

will do the trick (writes the date into the database correctly). So user_registered is right (​as the documentation suggests).

I know that this is just a small thing. However it's confusing if one constantly takes a look into the core code instead of the documentation.

Thanks

Attachments (1)

date_registered-to-user_registered.patch​ (913 bytes ) - added by floriansimeth 12 years ago.

Download all attachments as: .zip

Change History (4)

#1 @DrewAPicture
12 years ago

  • Component General → Posts, Post Types
  • Milestone Awaiting Review → 4.2
  • Owner set to DrewAPicture
  • Status new → reviewing
  • Type enhancement → defect (bug)
  • Version 4.1.1 → 4.1

Hi floriansimeth,

Nice catch! The patch looks good, and we should be able to get this in for 4.2 no problem. Thanks for the patch.

This was introduced in [29116].

#2 @SergeyBiryukov
12 years ago

  • Component Posts, Post Types → Users

#3 @DrewAPicture
12 years ago

  • Resolution → fixed
  • Status reviewing → closed

In 31608:

Correct a typo in the hash notation for wp_insert_user(): The argument name should be $user_registered not $date_registered.

Props floriansimeth.
Fixes #31513.

Note: See TracTickets for help on using tickets.