Changeset 7031 for branches/2.6/src/includes/users/functions.php
- Timestamp:
- 12/13/2019 09:25:05 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified branches/2.6/src/includes/users/functions.php ¶
r6866 r7031 229 229 230 230 // Update the option 231 $key = $user_id . '_new_email';232 $hash = md5( $_POST['email'] . time() . mt_rand() );233 231 $option = array( 234 'hash' => $hash,235 'newemail' => $_POST['email'] 232 'hash' => md5( $_POST['email'] . time() . wp_rand() ), 233 'newemail' => $_POST['email'], 236 234 ); 237 update_ option( $key, $option );235 update_user_meta( $user_id, '_new_email', $option ); 238 236 239 237 // Attempt to notify the user of email address change … … 315 313 // Get the displayed user ID & option key 316 314 $user_id = bbp_get_displayed_user_id(); 317 $key = $user_id .'_new_email';315 $key = '_new_email'; 318 316 $redirect_to = bbp_get_user_profile_edit_url( $user_id ); 319 317 … … 322 320 323 321 // Check for email address change option 324 $new_email = get_ option( $key);322 $new_email = get_user_meta( $user_id, $key, true ); 325 323 326 324 // Redirect if *no* email address change exists … … 331 329 // Cleanup & redirect if *invalid* email address change exists 332 330 if ( empty( $new_email['hash'] ) || empty( $new_email['newemail'] ) ) { 333 delete_ option($key );331 delete_user_meta( $user_id, $key ); 334 332 335 333 bbp_redirect( $redirect_to ); … … 341 339 // Does another user have this email address already? 342 340 if ( email_exists( $new_email['newemail'] ) ) { 343 delete_ option($key );341 delete_user_meta( $user_id, $key ); 344 342 345 343 bbp_add_error( 'bbp_user_email_taken', __( '<strong>ERROR</strong>: That email address is already in use.', 'bbpress' ), array( 'form-field' => 'email' ) ); … … 370 368 } 371 369 372 delete_ option($key );370 delete_user_meta( $user_id, $key ); 373 371 374 372 bbp_redirect( add_query_arg( array( 'updated' => 'true' ), $redirect_to ) ); … … 378 376 379 377 // Delete new email address from user options 380 } elseif ( ! empty( $_GET['dismiss'] ) && ( $key=== $_GET['dismiss'] ) ) {381 if ( ! bbp_verify_nonce_request( "dismiss-{$ key}" ) ) {378 } elseif ( ! empty( $_GET['dismiss'] ) && ( "{$user_id}{$key}" === $_GET['dismiss'] ) ) { 379 if ( ! bbp_verify_nonce_request( "dismiss-{$user_id}{$key}" ) ) { 382 380 bbp_add_error( 'bbp_dismiss_new_email_nonce', __( '<strong>ERROR</strong>: Are you sure you wanted to do that?', 'bbpress' ) ); 383 381 return; 384 382 } 385 383 386 delete_ option($key );384 delete_user_meta( $user_id, $key ); 387 385 bbp_redirect( $redirect_to ); 388 386 }
Note: See TracChangeset
for help on using the changeset viewer.