• Resolved jamesalexhall

    (@jamesalexhall)


    I am trying to create an alternative registration page. I have modified the default registration page using the “Pie Register” plugin to show additional sign up fields. I am trying to create a seperate page which shows the just the default registration fields. Just to confirm, I would like to code a new registration page from scratch which is not affected by any plugins I have installed.

    I cant find any tutorials or decent documentation on how to create a new register page. There are a few which show me how to modify the look of the default registration page using css but not how to create a new one.

    Any help or a point in the right direction would much appreciated.

    Im running wordpress 2.9.

    Thanks, James.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter jamesalexhall

    (@jamesalexhall)

    Thanks for you response MichaelH.

    Below is the solution I have been working on this afternoon. Thought I would post incase it is of any use to anyone in future. It’s a page template which provides a starting point for building an alternative registation form. This will allow creation of a customised registration form without hacking at the core wordpress files. It is also unaffected by any plugins overiding the default registration page (i.e. Register Plus or Pie Register).

    I would welcome any feedback as to how this might be improved.

    <?php
    /*
    Template Name: ALTERNATIVE USER REG
    */
    	// FUNCTION TO PREVENT DATABASE ATTACK - BEGIN
    		function check_input($value){
    
    			// Stripslashes
    			if (get_magic_quotes_gpc()){
    				$value = stripslashes($value);
    			}
    
    			// Quote if not a number
    			if (!is_numeric($value)){
    				$value = mysql_real_escape_string($value);
    			}
    			return $value;
    		}
    	// FUNCTION TO PREVENT DATABASE ATTACK - END
    
    	// CHECK TO SEE IF FORM HAS BEEN SUBMITTED
    	if($_POST['SubmitCheck']==1){
    
    		// CHECK TO ENSURE THAT USERNAME & PASSWORD FIELDS HAVE BEEN FILLED IN
    		if((trim($_POST['UserName'])=="") || (trim($_POST['Email'])=="")){
    			echo "Please enter a valid Username/Password";
    		}
    		else{
    
    			//GET VALUES SUBMITTED VIA FORM
    			$user_name = check_input($_POST['UserName']);
    			$user_email = check_input($_POST['Email']);
    
    			// GET REQUIRED WORDPRESS LIBRARIES
    			require_once(ABSPATH . WPINC . '/registration.php');
    			require_once(ABSPATH . WPINC . '/pluggable.php');
    
    			// CHECK WHETHER USERNAME EXISTS
    			if(username_exists($user_name)){
    				echo "This username already exists. Please enter another.";
    			}
    			else{
    
    				// CHECK WHETHER EMAIL ALREADY EXISTS
    				if(email_exists($user_email)){
    					echo "This email already exists. Please enter another.";
    				}
    				else{
    
    					// GENERATE A RANDOM PASSWORD
    					$random_password = wp_generate_password( 12, false );				
    
    					//CREATE THE WORDPRESS USER
    					$user_id = wp_create_user( $user_name, $random_password, $user_email );				
    
    					// SEND USER AND DATABASE ADMIN THE NOTIFICATION EMAIL
    					wp_new_user_notification( $user_id, $plaintext_pass );
    
    					// THANK YOU MESSAGE
    					echo "Thank you for registering. Please check your email.";			
    
    				}
    			}
    		}
    	}
    	else{
    
    		// IF THE FORM HASN'T BEEN SUBMITTED, OUTPUT THE REGISTRATION FORM
    
    		echo	'<form name="input" action="'.get_permalink().'" method="post">';
    
    		echo		'<p>Username:<br /><input type="text" name="UserName" /></p>';
    		echo		'<p>Email:<br /><input type="text" name="Email" /></p>';
    		echo		'<input type="hidden" name="SubmitCheck" value="1" />';
    		echo		'<p><input type="submit" value="Submit" /></p>';
    
    		echo	'</form>';
    
    	}
    
    // By James Alex Hall at https://www.jamesalexhall.co.uk
    
    ?>

    I’ve been looking for similar documentation on modifying the registration form. Not to mention possibly adding a step during the registration process. The closest I’ve found is it seems BuddyPress has replaced the standard WordPress registration form with its own registration form. So, that’s a starting point to look at. I also have found other plugins who take care of the registration process completely (s2 member for example) that I think has the code to do this too.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Alternative Registration Page’ is closed to new replies.