Make WordPress Core

Opened 13 years ago

Closed 13 years ago

#17967 closed defect (bug) (worksforme)

Ignoring the user ID in wp_create_user

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

Description

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

Change History (4)

#1 @scribu
13 years ago

  • Keywords reporter-feedback added; needs-testing removed

Please provide some example code that demonstrates this behaviour.

#2 @mostafa.s1990
13 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 {
		_e('Thankd!');
	}
Last edited 13 years ago by mostafa.s1990 (previous) (diff)

#3 @dd32
13 years ago

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

I cant reproduce this however.

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

results in:
object(WP_Error)[104]
  public 'errors' => 
    array
      'existing_user_login' => 
        array
          0 => string 'This username is already registered.' (length=36)
  public 'error_data' => 
    array
      empty

#4 @SergeyBiryukov
13 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.