bbp_edit_user_email_send_notification( $user_id, $args = array() )
Sends an email when an email address change occurs on POST requests
Description Description
See also See also
Source Source
File: includes/users/functions.php
function bbp_edit_user_email_send_notification( $user_id = 0, $args = array() ) { // Parse args $r = bbp_parse_args( $args, array( 'hash' => '', 'newemail' => '', ) ); // Bail if any relevant parameters are empty if ( empty( $user_id ) || empty( $r['hash'] ) || empty( $r['newemail'] ) ) { bbp_add_error( 'bbp_user_email_invalid_hash', __( '<strong>ERROR</strong>: An error occurred while updating your email address.', 'bbpress' ), array( 'form-field' => 'email' ) ); return; } // Build the nonced URL to dismiss the pending change $user_login = bbp_get_displayed_user_field( 'user_login', 'raw' ); $user_url = bbp_get_user_profile_edit_url( $user_id ); $confirm_url = add_query_arg( array( 'action' => 'bbp-update-user-email', 'newuseremail' => $r['hash'] ), $user_url ); $email_text = __( '%1$s Someone requested a change to the email address on your account. Please click the following link to confirm this change: %2$s If you did not request this, you can safely ignore and delete this notification. This email was sent to: %3$s Regards, The %4$s Team %5$s', 'bbpress' ); /** * Filter the email text sent when a user changes emails. * * The following strings have a special meaning and will get replaced dynamically: * * %1$s - The current user's username * %2$s - The link to click on to confirm the email change * %3$s - The new email * %4$s - The name of the site * %5$s - The URL to the site * * @param string $email_text Text in the email. * @param string $r New user email that the current user has changed to. */ $content = apply_filters( 'bbp_user_email_update_content', $email_text, $r ); // Build the email message $message = sprintf( $content, $user_login, $confirm_url, $r['newemail'], get_site_option( 'site_name' ), network_home_url() ); // Build the email subject $subject = sprintf( __( '[%s] New Email Address', 'bbpress' ), wp_specialchars_decode( get_option( 'blogname' ) ) ); // Send the email wp_mail( $r['newemail'], $subject, $message ); }
Changelog Changelog
Version | Description |
---|---|
2.6.0 | Introduced. |