• Hi all,
    i’ve to make a custom register page and i have some problems with
    wp_create_user() and wp_insert_user()

    Even if i include these files:

    include("[my_website_home]/wp-includes/user.php");
    include("[my_website_home]/wp-includes/class-wp-error.php");
    include("[my_website_home]/wp-blog-header.php");
    include("[my_website_home]/wp-load.php");

    if I call the function wp_create_user in this way:

    $unsafeEmail = $_POST['email'];
    $unsafeNome  = $_POST['nomeut'];
    $safeEmail = mysql_real_escape_string($unsafeEmail);
    $safeNome  = mysql_real_escape_string($unsafeNome);
    $safePassword =$_POST['passut'];
    
    wp_create_user($safeNome, $safePassword, $safeEmail);

    it has no effect.

    And if I try with this:

    $unsafeEmail = $_POST['email'];
    $unsafeNome  = $_POST['nomeut'];
    $safeEmail = mysql_real_escape_string($unsafeEmail);
    $safeNome  = mysql_real_escape_string($unsafeNome);
    $safePassword =$_POST['passut'];
    
    $user = array(
    		'user_login'=>$safeNome,
    		'user_pass'=>$safePassword,
    		'user_email'=>$safeEmail
    );
    wp_insert_user($user);

    it has no effect.

    What I have to include or what is wrong in my code?
    Thanks for the replies =)

  • The topic ‘Uses of wp_insert_user or wp_create_user’ is closed to new replies.