[wp-hackers] wp_insert_user

Ryan Fitzer ryanfitzer at gmail.com
Mon Aug 16 01:16:27 UTC 2010


I'm looking for any help on wp_insert_user in 3.0.1. I'm simply trying to
insert (not update) a new user. The function always returns 0 with no insert
taking place.

Looking through the source shows that the returned ID comes from
the $wpdb->insert_id on line 202 of /wp-includes/registration.php but I'm
not understanding why it's always 0. I get no errors either.

Example code:

$newUserData = array (
    [ID] => '',
    [user_pass] => wp_generate_password(),
    [user_login] => ryan,
    [user_nicename] => ryan,
    [user_url] => '',
    [user_email] => ryan at ryan.com,
    [display_name] => Ryan,
    [nickname] => ryan,
    [first_name] => ryan,
    [user_registered] => 2006-10-16 08:54:47,
    [role] => Administrator
);

$newUserId = wp_insert_user( $newUserData );

Thanks for any help.


More information about the wp-hackers mailing list