JoeHana
2/25/2014 - 2:37 AM

Customize Registration Form for wpCasa Portal

Customize Registration Form for wpCasa Portal

<?php

/**
 * Customize Registration Form for wpCasa Portal
 */

add_filter('wpsight_portal_form_registration', 'wpsc51_portal_form_registration');

function wpsc51_portal_form_registration() {
	
	// Get captcha image
	
	$captcha_src = WPSIGHT_ADMIN_URL . '/captcha/securimage_show.php';
	
	// Loop through custom profile contact fields
	
	$contact_fields = wpsight_profile_contact_fields();
	
	$profile_contact_fields = '';
	
	foreach( $contact_fields as $k => $v ) {
		
		$profile_contact_fields .= '<div class="wrap-field wrap-field-type-text wrap-user_' . $k . '"">' . "\n";
		$profile_contact_fields .= "\t" . '<label for="' . $k . '">' . $v['label'] . '</label>' . "\n";
		$profile_contact_fields .= "\t" . '<input type="text" name="' . $k . '" value="" id="' . $k . '" class="user text" />' . "\n";
		$profile_contact_fields .= '</div><!-- .wrap-user_' . $k . ' -->' . "\n\n";
		
	}
	
	$form = '<form action="" id="wpsight-portal-register-form" method="post" onSubmit="return false;">

			<div class="wrap-field wrap-field-type-text wrap-user_login">
				<label for="user_login">' . __( 'Username', 'wpsight-portal' ) . '</label>
				<input type="text" name="user_login" value="" id="user_login" class="text required" />
			</div>

		    <div class="wrap-field wrap-field-type-text wrap-user_email">
		    	<label for="user_email">' . __( 'Email', 'wpsight-portal' ) . '</label>
		    	<input type="email" name="user_email" value="" id="user_email" class="text required" />
		    </div><!-- .wrap-user_email -->
		
		    <div class="wrap-field wrap-field-type-text wrap-user_firstname">
		    	<label for="first_name">' . __( 'First Name', 'wpsight-portal' ) . '</label>
		   		<input type="text" name="first_name" value="" id="first_name" class="user text required" />
		    </div><!-- .wrap-user_firstname -->
		
		    <div class="wrap-field wrap-field-type-text wrap-user_lastname">
		    	<label for="last_name">' . __( 'Last Name', 'wpsight-portal' ) . '</label>
		    	<input type="text" name="last_name" value="" id="last_name" class="user text required" />
		    </div><!-- .wrap-last_name -->
		
		    <div class="wrap-field wrap-field-type-text wrap-user_website">
		    	<label for="user_url">' . __( 'Website', 'wpsight-portal' ) . '</label>
		    	<input type="url" name="user_url" value="" id="user_url" class="user text" />
		    </div><!-- .wrap-user_url -->';
	
	// Add custom profile contact fields
	
	$form .= $profile_contact_fields;
	
	$form .= '<div class="wrap-field wrap-field-type-textarea wrap-description">
		    	<label for="description">' . __( 'Description', 'wpsight-portal' ) . '</label>
		    	<textarea name="description" rows="20" cols="30" id="description" class="user text"></textarea>
		    </div><!-- .wrap-description -->
			
			<div class="wrap-field wrap-tos">
		    		    		
				<label class="checkbox">'.__('Please accept the terms of service', 'wpsight-portal').'<input type="checkbox" name="tos" id="tos" class="required" /></label>	    	
		
		    </div><!-- .wrap-tos -->
					
			<div class="wrap-field wrap-captcha clearfix">
		    
		    	<div class="captcha-image">		    
		    		<img id="captcha" src="' . $captcha_src . '" width="150" height="60" alt="Captcha" />
		    		<a href="" onclick="document.getElementById(\'captcha\').src = \'' . $captcha_src . '?\' + Math.random(); return false">[ '. __( 'Reload Image', 'wpsight-portal' ) .' ]</a>
		    	</div>
		    
		    	<div class="captcha-input">			    	
		    		<input type="text" name="captcha_code" id="captcha_code" size="5" maxlength="6" class="input-captcha required" />			    	
		    	</div>
		
		    </div><!-- .wrap-captcha -->		
		    	    	    	    
		    <div id="registration-footer" class="form-footer clearfix">

		        	<input type="hidden" name="submitted" id="submitted" value="true" />
		        	<input type="submit" class="btn btn-large" value="' . __( 'Register', 'wpsight-portal' ) . '" />
		        	    
		    </div><!-- #registration-footer -->
		    	    
		</form>';
	
	return $form;
}