[wp-trac] [WordPress Trac] #25745: Update user with wp_insert_user reset first and last name

WordPress Trac noreply at wordpress.org
Mon Oct 28 18:12:05 UTC 2013


#25745: Update user with wp_insert_user reset first and last name
--------------------------------------------+------------------------------
 Reporter:  sudoku1                         |       Owner:
     Type:  defect (bug)                    |      Status:  new
 Priority:  normal                          |   Milestone:  Awaiting Review
Component:  General                         |     Version:  3.6.1
 Severity:  major                           |  Resolution:
 Keywords:  dev-feedback reporter-feedback  |
--------------------------------------------+------------------------------

Comment (by sudoku1):

 Indeed! Also the mandatory presence of the user_login could be considered
 as an issue.
 BTW:

 {{{
 <?php

 $user_id = wp_insert_user(array(
     'user_login' => 'mario',
     'user_email' => 'mario at sudoku.com',
     'first_name' => 'Mario',
     'last_name'  => 'Bianchi',
     ));

 echo get_user_meta($user_id, 'first_name', true) . PHP_EOL;
 echo get_user_meta($user_id, 'last_name', true);

 $user_id = wp_insert_user(array(
     'ID'         => (int) $user_id,
     'user_login' => 'mario', // user_login mandatory???
     'user_email' => 'sudoku at mario.com' // !! Email chaged !!
     ));

 if ( ! is_wp_error($user_id) ) {

     $first_name = get_user_meta($user_id, 'first_name', true);
     $last_name  = get_user_meta($user_id, 'last_name', true);

     if ( empty($first_name) OR empty($last_name) ) {
         echo 'Huston, we have a problem!';
     }

 }
 }}}

--
Ticket URL: <http://core.trac.wordpress.org/ticket/25745#comment:6>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list