bp_email_wp_email_change_email( array $email_change_email, array $user, array $userdata )

Filters the contents of the email sent when the user’s email is changed.

Description

Parameters

$email_change_email

(Required) Used to build wp_mail().

  • 'to'
    (string) The intended recipients.
  • 'subject'
    (string) The subject of the email.
  • 'message'
    (string) The content of the email. The following strings have a special meaning and will get replaced dynamically: - ###USERNAME### The current user's username. - ###ADMIN_EMAIL### The admin email in case this was unexpected. - ###NEW_EMAIL### The new email address. - ###EMAIL### The old email address. - ###SITENAME### The name of the site. - ###SITEURL### The URL to the site.
  • 'headers'
    (string) Headers.

$user

(Required) The original user array.

$userdata

(Required) The updated user array.

Return

(array) $email_change_email Email change array

Source

File: bp-core/bp-core-wp-emails.php

	function bp_email_wp_email_change_email( $email_change_email, $user, $userdata ) {

		/* translators: Do not translate USERNAME, ADMIN_EMAIL, EMAIL, SITENAME, SITEURL: those are placeholders. */
		$email_change_text = '<p>' . __( 'Hi ###USERNAME###,', 'buddyboss' ) . '</p>';
		$email_change_text .= '<p>' . __( 'This notice confirms that your email address on ###SITENAME### was changed to ###NEW_EMAIL###.', 'buddyboss' ) . '</p>';
		$email_change_text .= '<p>' . __( 'If you did not change your email, please contact the Site Administrator at <br/>###ADMIN_EMAIL###', 'buddyboss' ) . '</p>';
		$email_change_text .= '<p>' . __( 'This email has been sent to ###EMAIL###', 'buddyboss' ) . '</p>';
		$email_change_text .= '<p>' . __( 'Regards, <br />All at ###SITENAME### <br />###SITEURL###', 'buddyboss' ) . '</p>';

		$email_change_email = array(
			'to'      => $user['user_email'],
			/* translators: User email change notification email subject. 1: Site name */
			'subject' => __( '[%s] Notice of Email Change', 'buddyboss' ),
			'message' => $email_change_text,
			'headers' => '',
		);

		add_filter( 'wp_mail_content_type', 'bp_email_set_content_type' ); //add this to support html in email

		$email_change_email = bp_email_core_wp_get_template( $email_change_email, $user );

		return $email_change_email;
	}

Changelog

Changelog
Version Description
BuddyBoss 1.0.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.