Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#17967 closed defect (bug) (worksforme)

Ignoring the user ID in wp_create_user

Reported by: mostafa.s1990 Owned by: Mostafa Soufi
Milestone: Priority: normal
Severity: normal Version: 3.1.4
Component: Users Keywords: reporter-feedback
Focuses: Cc:


Hello If you use this function, Ignores old users.
The new user will replace the previous
With all the information

Change History (4)

#1 @scribu
7 years ago

  • Keywords reporter-feedback added; needs-testing removed

Please provide some example code that demonstrates this behaviour.

#2 @mostafa.s1990
7 years ago

Replying to scribu:

Please provide some example code that demonstrates this behaviour.

	// variable for test
	$user_name	=	$_POST['author_user_name'];
	$password	=	wp_generate_password();
	$email		=	$_POST['author_user_email'];
	// function test
	$user_id	=	wp_create_user($user_name, $password, $email) ;

	// check error
	if ( is_wp_error($user_id) ){
		$register_error = $user_id->get_error_message();
		echo $register_error;
	} else {
Last edited 7 years ago by mostafa.s1990 (previous) (diff)

#3 @dd32
7 years ago

check to see if the user exists before creating a user: username_exists($username)

I cant reproduce this however.

var_dump( wp_create_user('admin', 'password', 'test2@localhost') );

results in:
  public 'errors' => 
      'existing_user_login' => 
          0 => string 'This username is already registered.' (length=36)
  public 'error_data' => 

#4 @SergeyBiryukov
7 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Can't reproduce either.

Feel free to reopen with more information if there's still a problem.

Note: See TracTickets for help on using tickets.