PluginProbe
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor / 2.0.6
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor v2.0.6
4.0.2 4.0.1 4.0.0 3.16.6 3.16.5 3.16.4 3.16.3 3.16.2 3.16.1 3.16.0 3.15.9 3.9.9 3.9.5 3.9.6 3.9.7 3.9.8 1.1.7 1.1.8 1.1.9 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 All 340 releases
profile-builder / front-end / default-fields / password-repeat / password-repeat.php

password-repeat.php in User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor 2.0.6, at front-end/default-fields/password-repeat/password-repeat.php

44 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /* handle field output */
3 function wppb_password_repeat_handler( $output, $form_location, $field, $user_id, $field_check_errors, $request_data ){
4 $item_title = apply_filters( 'wppb_'.$form_location.'_password_item_title', wppb_icl_t( 'plugin profile-builder-pro', 'default_field_'.$field['id'].'_title_translation', $field['field-title'] ) );
5 $item_description = wppb_icl_t( 'plugin profile-builder-pro', 'default_field_'.$field['id'].'_description_translation', $field['description'] );
6
7 if ( $form_location != 'back_end' ){
8 $error_mark = ( ( $field['required'] == 'Yes' ) ? '<span class="wppb-required" title="'.wppb_required_field_error($field["field-title"]).'">*</span>' : '' );
9
10 if ( array_key_exists( $field['id'], $field_check_errors ) )
11 $error_mark = '<img src="'.WPPB_PLUGIN_URL.'assets/images/pencil_delete.png" title="'.wppb_required_field_error($field["field-title"]).'"/>';
12
13 $output = '
14 <label for="passw2">' . $item_title.$error_mark . '</label>
15 <input class="text-input" name="passw2" maxlength="'. apply_filters( 'wppb_maximum_character_length', 70 ) .'" type="password" id="passw2" value="" autocomplete="off" />';
16 if( !empty( $item_description ) )
17 $output .= '<span class="wppb-description-delimiter">'.$item_description.'</span>';
18 }
19
20 return apply_filters( 'wppb_'.$form_location.'_repeat_password', $output, $form_location, $field, $user_id, $field_check_errors, $request_data );
21 }
22 add_filter( 'wppb_output_form_field_default-repeat-password', 'wppb_password_repeat_handler', 10, 6 );
23
24
25 /* handle field validation */
26 function wppb_check_repeat_password_value( $message, $field, $request_data, $form_location ){
27 if ( $form_location == 'register' ){
28 if ( ( isset( $request_data['passw2'] ) && ( trim( $request_data['passw2'] ) == '' ) ) && ( $field['required'] == 'Yes' ) )
29 return wppb_required_field_error($field["field-title"]);
30
31 elseif ( !isset( $request_data['passw2'] ) && ( $field['required'] == 'Yes' ) )
32 return wppb_required_field_error($field["field-title"]);
33
34 elseif ( isset( $request_data['passw1'] ) && isset( $request_data['passw2'] ) && ( trim( $request_data['passw1'] ) != trim( $request_data['passw2'] ) ) && ( $field['required'] == 'Yes' ) )
35 return __( "The passwords do not match", "profilebuilder" );
36
37 }elseif ( $form_location == 'edit_profile' ){
38 if ( isset( $request_data['passw1'] ) && isset( $request_data['passw2'] ) && ( trim( $request_data['passw1'] ) != trim( $request_data['passw2'] ) ) )
39 return __( "The passwords do not match", "profilebuilder" );
40 }
41
42 return $message;
43 }
44 add_filter( 'wppb_check_form_field_default-repeat-password', 'wppb_check_repeat_password_value', 10, 4 );