Advertisement
Guest User

Untitled

a guest
Jan 7th, 2014
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.97 KB | None | 0 0
  1. add_filter ('wppb_edit_profile_content_about_yourself3', 'makePassReq', 10, 3 );
  2. function makePassReq ( $pass, $errorVar, $errorMark ){
  3.  
  4.     $errorMark = '<font color="red" title="This field is required for registration.">*</font>';
  5.     $errorMark2 = '<font color="red" title="This field is required for registration.">*</font>';
  6.    
  7.     if ( isset ( $_POST['pass1'] ) && ( trim( $_POST['pass1'] ) == '' ) ){
  8.         $errorMark = '<img src="'.WPPB_PLUGIN_URL . 'assets/images/pencil_delete.png" title="This field is required for registration."/>';
  9.         $errorVar = ' errorHolder';
  10.     }
  11.    
  12.     if ( isset ($_POST['pass2']) && ( trim($_POST['pass2']) == '' ) ){
  13.         $errorMark2 = '<img src="'.WPPB_PLUGIN_URL . 'assets/images/pencil_delete.png" title="This field is required for registration."/>';
  14.         $errorVar2 = ' errorHolder';
  15.     }
  16.  
  17.    
  18.    
  19.     return '<p class="form-password'.$errorVar.'">
  20.             <label for="pass1">'. __('New Password', 'profilebuilder') .$errorMark.'</label>
  21.             <input class="text-input" name="pass1" type="password" id="pass1" />
  22.             </p><!-- .form-password -->
  23.  
  24.             <p class="form-password'.$errorVar2.'">
  25.             <label for="pass2">'. __('Repeat Password', 'profilebuilder') .$errorMark2.'</label>
  26.             <input class="text-input" name="pass2" type="password" id="pass2" />
  27.             </p><!-- .form-password -->';
  28. }
  29.  
  30.  
  31.  
  32. add_filter ('wppb_edit_profile_extra_error', 'addExtraWarning');
  33. function addExtraWarning( $old ){
  34.     if (( empty($_POST['pass1'] ) || empty( $_POST['pass2'] )) || ( $_POST['pass1'] != $_POST['pass2'] )){
  35.         if ( empty($_POST['pass1'] ) || empty( $_POST['pass2'] ))                                                    //verify if the user has completed both password fields
  36.             return __('You didn\'t complete one of the password-fields!', 'profilebuilder');
  37.                
  38.         elseif ( $_POST['pass1'] != $_POST['pass2'] )                                                                  //verify if the the password and the retyped password are a match
  39.             return __('The entered passwords don\'t match!', 'profilebuilder');
  40.  
  41.     }
  42.    
  43.     return $old;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement