PluginProbe
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor / 4.0.3
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor v4.0.3
4.0.3 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 All 341 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 4.0.3, at front-end/default-fields/password-repeat/password-repeat.php

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