No validation mail when change email in settings
-
Hello everybody,
I wish you’re doing the summer great !
There is my problem : When a user change is email in the setting page, he’ll not receive the validation mail in the old adress. (I tried to search in the support page but i didn’t find a post about that). I’m using a plugin to send mail with SMTP (POSTMAN SMTP) and the validation mail when register works.
So i don’t understand why it doesn’t work for the email changing ?
Thanks for your help 🙂
There is the function in bp-setting-action.php used for that (nothing wrong second me):
if ( !empty( $_POST['email'] ) ) { // What is missing from the profile page vs signup - // let's double check the goodies $user_email = sanitize_email( esc_html( trim( $_POST['email'] ) ) ); $old_user_email = $bp->displayed_user->userdata->user_email; // User is changing email address if ( $old_user_email != $user_email ) { // Run some tests on the email address $email_checks = bp_core_validate_email_address( $user_email ); if ( true !== $email_checks ) { if ( isset( $email_checks['invalid'] ) ) { $email_error = 'invalid'; } if ( isset( $email_checks['domain_banned'] ) || isset( $email_checks['domain_not_allowed'] ) ) { $email_error = 'blocked'; } if ( isset( $email_checks['in_use'] ) ) { $email_error = 'taken'; } } // Store a hash to enable email validation if ( false === $email_error ) { $hash = wp_hash( $_POST['email'] ); $pending_email = array( 'hash' => $hash, 'newemail' => $user_email, ); bp_update_user_meta( bp_displayed_user_id(), 'pending_email_change', $pending_email ); $email_text = sprintf( __( 'Dear %1$s, You recently changed the email address associated with your account on %2$s. If this is correct, please click on the following link to complete the change: %3$s You can safely ignore and delete this email if you do not want to take this action or if you have received this email in error. This email has been sent to %4$s. Regards, %5$s %6$s', 'buddypress' ), bp_core_get_user_displayname( bp_displayed_user_id() ), bp_get_site_name(), esc_url( bp_displayed_user_domain() . bp_get_settings_slug() . '/?verify_email_change=' . $hash ), $user_email, bp_get_site_name(), bp_get_root_domain() ); /** * Filter the email text sent when a user changes emails. * * @since BuddyPress (2.1.0) * * @param string $email_text Text of the email. * @param string $new_user_email New user email that the * current user has changed to. * @param string $old_user_email Existing email address * for the current user. * @param WP_User $update_user Userdata object for the current user. */ $content = apply_filters( 'bp_new_user_email_content', $email_text, $user_email, $old_user_email, $update_user ); // Send the verification email wp_mail( $user_email, sprintf( __( '[%s] Verify your new email address', 'buddypress' ), wp_specialchars_decode( bp_get_site_name() ) ), $content ); // We mark that the change has taken place so as to ensure a // success message, even though verification is still required $_POST['email'] = $update_user->user_email; $email_changed = true; } // No change } else { $email_error = false; } // Email address cannot be empty } else { $email_error = 'empty'; }
- The topic ‘No validation mail when change email in settings’ is closed to new replies.