user($udata) raises PHP warning in wp

2013 年 5 月 8 日4780

    erikstainsby

    Member

    Posted 3 hours ago

    The following code both 1) triggers a PHP warning in menu-header.php (which seems whacked out to me), and 2) fails to insert the new user record as desired:

    $userdata = array(



    'user_login'=> $_POST['username'],



    'nickname' => $_POST['nick'],



    'user_email'=> $_POST['email'],



    'user_pass' => $_POST['password'],



    'role' => 'author'



    );



    if( email_exists($userdata['user_email']) == false && username_exists($userdata['user_login'])== false )



    {



    error_log( "name & email do not already exist" );



    // do the creation deed



    $user_id = wp_insert_user($userdata);



    }

    What I can't figure out is why the devil this code is triggering wp-admin/menu-header.php at all ?

    (Note: the usual security precautions have been stripped away during debugging; I do know how to sanitized user input.)

Reply

You must log in to post.

About this Topic

Tags

wp_insert_user insert user fail

0 0