diff --git src/bp-settings/actions/general.php src/bp-settings/actions/general.php
index 10e33acb3..ba6199fd9 100644
|
|
function bp_settings_action_general() { |
58 | 58 | // Validate the user again for the current password when making a big change. |
59 | 59 | if ( ( is_super_admin() ) || ( !empty( $_POST['pwd'] ) && wp_check_password( $_POST['pwd'], $bp->displayed_user->userdata->user_pass, bp_displayed_user_id() ) ) ) { |
60 | 60 | |
61 | | $update_user = get_userdata( bp_displayed_user_id() ); |
| 61 | $update_user = array( |
| 62 | 'ID' => (int) bp_displayed_user_id(), |
| 63 | ); |
62 | 64 | |
63 | 65 | /* Email Change Attempt ******************************************/ |
64 | 66 | |
65 | | if ( !empty( $_POST['email'] ) ) { |
| 67 | if ( ! empty( $_POST['email'] ) ) { |
66 | 68 | |
67 | 69 | // What is missing from the profile page vs signup - |
68 | 70 | // let's double check the goodies. |
… |
… |
function bp_settings_action_general() { |
70 | 72 | $old_user_email = $bp->displayed_user->userdata->user_email; |
71 | 73 | |
72 | 74 | // User is changing email address. |
73 | | if ( $old_user_email != $user_email ) { |
| 75 | if ( $old_user_email !== $user_email ) { |
74 | 76 | |
75 | 77 | // Run some tests on the email address. |
76 | 78 | $email_checks = bp_core_validate_email_address( $user_email ); |
… |
… |
function bp_settings_action_general() { |
114 | 116 | |
115 | 117 | // We mark that the change has taken place so as to ensure a |
116 | 118 | // success message, even though verification is still required. |
117 | | $_POST['email'] = $update_user->user_email; |
118 | 119 | $email_changed = true; |
119 | 120 | } |
120 | 121 | |
… |
… |
function bp_settings_action_general() { |
138 | 139 | if ( ! $pass_error->get_error_message() ) { |
139 | 140 | // Password change attempt is successful. |
140 | 141 | if ( ( ! empty( $_POST['pwd'] ) && wp_unslash( $_POST['pwd'] ) !== $pass ) || is_super_admin() ) { |
141 | | $update_user->user_pass = $_POST['pass1']; |
142 | | $pass_error = false; |
143 | | $pass_changed = true; |
| 142 | $update_user['user_pass'] = $_POST['pass1']; |
| 143 | $pass_error = false; |
| 144 | $pass_changed = true; |
144 | 145 | |
145 | 146 | // The new password is the same as the current password. |
146 | 147 | } else { |
… |
… |
function bp_settings_action_general() { |
157 | 158 | $pass_error = new WP_Error( 'empty_user_password', __( 'One of the password fields was empty.', 'buddypress' ) ); |
158 | 159 | } |
159 | 160 | |
160 | | // The structure of the $update_user object changed in WP 3.3, but |
161 | | // wp_update_user() still expects the old format. |
162 | | if ( isset( $update_user->data ) && is_object( $update_user->data ) ) { |
163 | | $update_user = $update_user->data; |
164 | | $update_user = get_object_vars( $update_user ); |
165 | | |
166 | | // Unset the password field to prevent it from emptying out the |
167 | | // user's user_pass field in the database. |
168 | | // @see wp_update_user(). |
169 | | if ( false === $pass_changed ) { |
170 | | unset( $update_user['user_pass'] ); |
171 | | } |
| 161 | // Unset the password field to prevent it from emptying out the |
| 162 | // user's user_pass field in the database. |
| 163 | if ( false === $pass_changed ) { |
| 164 | unset( $update_user['user_pass'] ); |
172 | 165 | } |
173 | 166 | |
174 | 167 | // Clear cached data, so that the changed settings take effect |