PluginProbe
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor / 2.0.7
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor v2.0.7
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 / password.php

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

63 lines 3.3 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_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="passw1">' . $item_title.$error_mark . '</label>
15 <input class="text-input" name="passw1" maxlength="'. apply_filters( 'wppb_maximum_character_length', 70 ) .'" type="password" id="passw1" value="" autocomplete="off" />';
16 if( !empty( $item_description ) )
17 $output .= '<span class="wppb-description-delimiter">'.$item_description.' '.wppb_password_length_text().'</span>';
18 else
19 $output .= '<span class="wppb-description-delimiter">'.wppb_password_length_text().'</span>';
20
21 /* if we have active the password strength checker */
22 $output .= wppb_password_strength_checker_html();
23
24 }
25
26 return apply_filters( 'wppb_'.$form_location.'_password', $output, $form_location, $field, $user_id, $field_check_errors, $request_data );
27 }
28 add_filter( 'wppb_output_form_field_default-password', 'wppb_password_handler', 10, 6 );
29
30 /* handle field validation */
31 function wppb_check_password_value( $message, $field, $request_data, $form_location ){
32 if ( $form_location == 'register' ){
33 if ( ( isset( $request_data['passw1'] ) && ( trim( $request_data['passw1'] ) == '' ) ) && ( $field['required'] == 'Yes' ) )
34 return wppb_required_field_error($field["field-title"]);
35
36 elseif ( !isset( $request_data['passw1'] ) && ( $field['required'] == 'Yes' ) )
37 return wppb_required_field_error($field["field-title"]);
38 }
39
40 if ( trim( $request_data['passw1'] ) != '' ){
41 $wppb_generalSettings = get_option( 'wppb_general_settings' );
42
43 if( wppb_check_password_length( $request_data['passw1'] ) )
44 return __( "<br/>The password must have the minimum length of ". $wppb_generalSettings['minimum_password_length'] ." characters", "profilebuilder" );
45
46
47 if( wppb_check_password_strength() ){
48 return __( "<br/>The password must have a minimum strength of ". wppb_check_password_strength(), "profilebuilder" );
49 }
50 }
51
52 return $message;
53 }
54 add_filter( 'wppb_check_form_field_default-password', 'wppb_check_password_value', 10, 4 );
55
56 /* handle field save */
57 function wppb_userdata_add_password( $userdata, $global_request ){
58 if ( isset( $global_request['passw1'] ) && ( trim( $global_request['passw1'] ) != '' ) )
59 $userdata['user_pass'] = trim( $global_request['passw1'] );
60
61 return $userdata;
62 }
63 add_filter( 'wppb_build_userdata', 'wppb_userdata_add_password', 10, 2 );