Create user using wp_create_user


<?php

$base = dirname(__FILE__);

    require( dirname(dirname(dirname($base))) .'/wp-blog-header.php');
     
    $user_name =$_POST['signup_username'];
    $user_email = $_POST['signup_email'];
     
    $user_id = username_exists( $user_name );
    if ( !$user_id ) {
    $random_password = wp_generate_password( 12, false );
    $user_id = wp_create_user( $user_name, $random_password, $user_email );
    } else {
    $random_password = __('User already exists. Password inherited.');
    }
?>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s