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 / admin / advanced-settings / includes / fields / automatically-generate-password.php

automatically-generate-password.php in User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor 4.0.3, at admin/advanced-settings/includes/fields/automatically-generate-password.php

86 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // Exit if accessed directly
4 if ( ! defined( 'ABSPATH' ) ) exit;
5
6 $wppb_general_settings = get_option( 'wppb_general_settings' );
7
8 if ( isset( $wppb_general_settings['emailConfirmation'] ) && $wppb_general_settings['emailConfirmation'] == 'yes' ) {
9 add_filter( 'wppb_register_user_email_message_with_admin_approval', 'wppb_toolbox_ec_generate_password', 20, 5 );
10 add_filter( 'wppb_register_user_email_message_without_admin_approval', 'wppb_toolbox_ec_generate_password', 20, 5 );
11 }
12
13 add_filter( 'wppb_check_form_field_default-password', 'wppb_toolbox_check_password_value', 20, 4 );
14 add_filter( 'wppb_check_form_field_default-repeat-password', 'wppb_toolbox_check_password_value', 20, 4 );
15 function wppb_toolbox_check_password_value( $message, $field, $request_data, $form_location ){
16 if ( $form_location == 'register' )
17 return;
18
19 return $message;
20 }
21
22 add_filter( 'wppb_register_password', '__return_empty_string', 10, 6 );
23 add_filter( 'wppb_register_repeat_password', '__return_empty_string', 10, 6 );
24 add_filter( 'wppb_send_password_in_default_email_message', '__return_true' );
25
26 add_filter('wppb_send_credentials_checkbox_logic', 'wppb_toolbox_send_credentials', 10, 2);
27 function wppb_toolbox_send_credentials($requestdata, $form){
28 return '<input id="send_credentials_via_email" type="hidden" name="send_credentials_via_email" value="sending" />';
29 }
30
31 add_filter( 'wppb_build_userdata', 'wppb_toolbox_generate_password', 20, 2 );
32 function wppb_toolbox_generate_password( $userdata, $global_request ) {
33
34 if ( $global_request['action'] == 'register' ) {
35 $userdata['user_pass'] = wp_generate_password();
36
37 return $userdata;
38 }
39
40 return $userdata;
41 }
42
43 add_filter( 'pms_stripe_wppb_password', 'wppb_toolbox_generate_password_stripe_wppb_checkout' );
44 function wppb_toolbox_generate_password_stripe_wppb_checkout( $password ){
45
46 return wp_generate_password();
47
48 }
49
50 function wppb_toolbox_ec_generate_password( $content, $email, $password, $user_message_subject, $context ) {
51 if ( empty( $email ) ) return $content;
52
53 $user = get_user_by( 'email', $email );
54
55 if ( $user === false ) return $content;
56
57 $password = wp_generate_password();
58
59 wp_set_password( $password, $user->ID );
60
61 $content = str_replace( __( 'Your selected password at signup', 'profile-builder' ), $password, $content );
62
63 return $content;
64 }
65
66 // Replace Password in User Approved Email
67 add_filter( 'wppb_new_user_status_message_approved', 'wppb_toolbox_admin_approval_generate_password', 20, 5 );
68 function wppb_toolbox_admin_approval_generate_password( $content, $user_info, $status, $user_message_from, $context ){
69
70 if( empty( $user_info->user_email ) )
71 return $content;
72
73 $user = get_user_by( 'email', $user_info->user_email );
74
75 if ( $user === false ) return $content;
76
77 $password = wp_generate_password();
78
79 wp_set_password( $password, $user->ID );
80
81 $content = str_replace( __( 'Your selected password at signup', 'profile-builder' ), $password, $content );
82
83 return $content;
84
85 }
86