Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter ('wppb_edit_profile_content_about_yourself3', 'makePassReq', 10, 3 );
- function makePassReq ( $pass, $errorVar, $errorMark ){
- $errorMark = '<font color="red" title="This field is required for registration.">*</font>';
- $errorMark2 = '<font color="red" title="This field is required for registration.">*</font>';
- if ( isset ( $_POST['pass1'] ) && ( trim( $_POST['pass1'] ) == '' ) ){
- $errorMark = '<img src="'.WPPB_PLUGIN_URL . 'assets/images/pencil_delete.png" title="This field is required for registration."/>';
- $errorVar = ' errorHolder';
- }
- if ( isset ($_POST['pass2']) && ( trim($_POST['pass2']) == '' ) ){
- $errorMark2 = '<img src="'.WPPB_PLUGIN_URL . 'assets/images/pencil_delete.png" title="This field is required for registration."/>';
- $errorVar2 = ' errorHolder';
- }
- return '<p class="form-password'.$errorVar.'">
- <label for="pass1">'. __('New Password', 'profilebuilder') .$errorMark.'</label>
- <input class="text-input" name="pass1" type="password" id="pass1" />
- </p><!-- .form-password -->
- <p class="form-password'.$errorVar2.'">
- <label for="pass2">'. __('Repeat Password', 'profilebuilder') .$errorMark2.'</label>
- <input class="text-input" name="pass2" type="password" id="pass2" />
- </p><!-- .form-password -->';
- }
- add_filter ('wppb_edit_profile_extra_error', 'addExtraWarning');
- function addExtraWarning( $old ){
- if (( empty($_POST['pass1'] ) || empty( $_POST['pass2'] )) || ( $_POST['pass1'] != $_POST['pass2'] )){
- if ( empty($_POST['pass1'] ) || empty( $_POST['pass2'] )) //verify if the user has completed both password fields
- return __('You didn\'t complete one of the password-fields!', 'profilebuilder');
- elseif ( $_POST['pass1'] != $_POST['pass2'] ) //verify if the the password and the retyped password are a match
- return __('The entered passwords don\'t match!', 'profilebuilder');
- }
- return $old;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement