Trying to create a custom registration page for a theme,


Trying to create a custom registration page for a theme, i have created the custom login and registration but the way it is now, its not how i want it. i want it to be able to allow users to enter the name of the site they wished to create just like when using the default WP wp-signup.php file. Don’t know if u get what am saying. here’s what i have.

require_once(ABSPATH . WPINC . '/registration.php');
global $wpdb, $user_ID;
//Check whether the user is already logged in
if ($user_ID) {

// They're already logged in, so we bounce them back to the homepage.

wp_redirect(home_url() );

} else {

$errors = array();


// Check username is present and not already in use
$username = $wpdb->escape($_REQUEST['username']);
if ( strpos($username, ' ') !== false ) {
$errors['username'] = "Sorry, no spaces allowed in usernames";
if(empty($username)) {
$errors['username'] = "Please enter a username";
} elseif( username_exists( $username ) ) {
$errors['username'] = "Username already exists, please try another";

// Check email address is present and valid
$email = $wpdb->escape($_REQUEST['email']);
if( !is_email( $email ) ) {
$errors['email'] = "Please enter a valid email";
} elseif( email_exists( $email ) ) {
$errors['email'] = "This email address is already in use";

// Check password is valid
if(0 === preg_match("/.{6,}/", $_POST['password'])){
$errors['password'] = "Password must be at least six characters";

// Check password confirmation_matches
if(0 !== strcmp($_POST['password'], $_POST['password_confirmation'])){
$errors['password_confirmation'] = "Passwords do not match";

// Check terms of service is agreed to
if($_POST['terms'] != "Yes"){
$errors['terms'] = "You must agree to Terms of Service";

if(0 === count($errors)) {

$password = $_POST['password'];

$new_user_id = wp_create_user( $username, $password, $email );

// send an email to the admin alerting them of the registration

// log the new user in
wp_setcookie($user_login, $user_pass, true);
wp_set_current_user($new_user_id, $user_login);
do_action('wp_login', $user_login);

// send the newly created user to the home page after logging them in

$success = 1;
wp_redirect(home_url()); exit;
// header( 'Location:/signin/?success=1&u=' . $username );


?><form id="wp_signup_form" action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post">

<label for="username">Username</label>
<input type="text" name="username" id="username">
<label for="email">Email address</label>
<input type="text" name="email" id="email">
<label for="password">Password</label>
<input type="password" name="password" id="password">
<label for="password_confirmation">Confirm Password</label>
<input type="password" name="password_confirmation" id="password_confirmation">

<input name="terms" id="terms" type="checkbox" value="Yes">
<label for="terms">I agree to the Terms of Service</label>

<input type="submit" id="submitbtn" name="submit" value="Sign Up" />