WordPress.org

Ready to get started?Download WordPress

Forums

Uses of wp_insert_user or wp_create_user (1 post)

  1. Daveblack
    Member
    Posted 1 year ago #

    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 =)

Topic Closed

This topic has been closed to new replies.

About this Topic