Changeset 13043 for trunk/src/bp-settings/actions/general.php
- Timestamp:
- 08/13/2021 01:19:38 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-settings/actions/general.php
r13032 r13043 246 246 // Email change is being verified. 247 247 if ( isset( $_GET['verify_email_change'] ) ) { 248 $pending_email = bp_get_user_meta( bp_displayed_user_id(), 'pending_email_change', true ); 248 $user_id = bp_displayed_user_id(); 249 $pending_email = (array) bp_get_user_meta( $user_id, 'pending_email_change', true ); 250 251 // The user may have dismissed the email change. 252 if ( ! array_filter( $pending_email ) ) { 253 /** 254 * Fires when a Pending Email Change is missing and before 255 * BuddyPress redirects the user to an error message. 256 * 257 * @since 9.1.0 258 * 259 * @param int $user_id The user ID. 260 * @param string $redirect_to The Default Front-end Settings Screen URL. 261 */ 262 do_action( 'bp_settings_missing_pending_email_change_hash', $user_id, $redirect_to ); 263 264 bp_core_add_message( __( 'There was a problem verifying your new email address. If you haven’t dismissed the pending email change, please request a new email update.', 'buddypress' ), 'error' ); 265 bp_core_redirect( $redirect_to ); 266 } 249 267 250 268 // Bail if the hash provided doesn't match the one saved in the database. … … 254 272 255 273 $email_changed = wp_update_user( array( 256 'ID' => bp_displayed_user_id(),274 'ID' => $user_id, 257 275 'user_email' => trim( $pending_email['newemail'] ), 258 276 ) ); 259 277 260 278 if ( $email_changed ) { 261 262 279 // Delete the pending email change key. 263 bp_delete_user_meta( bp_displayed_user_id(), 'pending_email_change' ); 280 bp_delete_user_meta( $user_id, 'pending_email_change' ); 281 282 /** 283 * Fires when a Pending Email Change has been validated and before 284 * BuddyPress redirects the user to a success message. 285 * 286 * @since 9.1.0 287 * 288 * @param int $user_id The user ID. 289 * @param string $redirect_to The Default Front-end Settings Screen URL. 290 */ 291 do_action( 'bp_settings_email_changed', $user_id, $redirect_to ); 264 292 265 293 // Post a success message and redirect. … … 271 299 272 300 bp_core_redirect( $redirect_to ); 273 die();274 301 275 302 // Email change is being dismissed. … … 278 305 279 306 if ( $nonce_check ) { 280 bp_delete_user_meta( bp_displayed_user_id(), 'pending_email_change' ); 307 $user_id = bp_displayed_user_id(); 308 bp_delete_user_meta( $user_id, 'pending_email_change' ); 309 310 /** 311 * Fires when a Pending Email Change has been dismissed and before 312 * BuddyPress redirects the user to a success message. 313 * 314 * @since 9.1.0 315 * 316 * @param int $user_id The user ID. 317 * @param string $redirect_to The Default Front-end Settings Screen URL. 318 */ 319 do_action( 'bp_settings_email_change_dismissed', $user_id, $redirect_to ); 320 281 321 bp_core_add_message( __( 'You have successfully dismissed your pending email change.', 'buddypress' ) ); 282 322 } 283 323 284 324 bp_core_redirect( $redirect_to ); 285 die();286 325 } 287 326 }
Note: See TracChangeset
for help on using the changeset viewer.