*' : '' ); if ( array_key_exists( $field['id'], $field_check_errors ) ) $error_mark = ''; $extra_attr = apply_filters( 'wppb_extra_attribute', '', $field, $form_location ); $output = ' '; if( !empty( $item_description ) ) $output .= ''.$item_description.' '.wppb_password_length_text().''; else $output .= ''.wppb_password_length_text().''; /* if we have active the password strength checker */ $output .= wppb_password_strength_checker_html(); } return apply_filters( 'wppb_'.$form_location.'_password', $output, $form_location, $field, $user_id, $field_check_errors, $request_data ); } add_filter( 'wppb_output_form_field_default-password', 'wppb_password_handler', 10, 6 ); /* handle field validation */ function wppb_check_password_value( $message, $field, $request_data, $form_location ){ if ( $form_location == 'register' ){ if ( ( isset( $request_data['passw1'] ) && ( trim( $request_data['passw1'] ) == '' ) ) && ( $field['required'] == 'Yes' ) ) return wppb_required_field_error($field["field-title"]); elseif ( !isset( $request_data['passw1'] ) && ( $field['required'] == 'Yes' ) ) return wppb_required_field_error($field["field-title"]); } if ( trim( $request_data['passw1'] ) != '' ){ $wppb_generalSettings = get_option( 'wppb_general_settings' ); if( wppb_check_password_length( $request_data['passw1'] ) ) return '
'. sprintf( __( "The password must have the minimum length of %s characters", "profile-builder" ), $wppb_generalSettings['minimum_password_length'] ); if( wppb_check_password_strength() ){ return '
' . sprintf( __( "The password must have a minimum strength of %s", "profile-builder" ), wppb_check_password_strength() ); } } return $message; } add_filter( 'wppb_check_form_field_default-password', 'wppb_check_password_value', 10, 4 ); /* handle field save */ function wppb_userdata_add_password( $userdata, $global_request ){ if ( isset( $global_request['passw1'] ) && ( trim( $global_request['passw1'] ) != '' ) ) $userdata['user_pass'] = trim( $global_request['passw1'] ); return $userdata; } add_filter( 'wppb_build_userdata', 'wppb_userdata_add_password', 10, 2 );