bp_email_retrieve_password_message( string $message, string $key, string $user_login, WP_User $user_data )

Filters the message body of the password reset mail.

Description

If the filtered message is empty, the password reset email will not be sent.

Parameters

$message

(string) (Required) Default mail message.

$key

(string) (Required) The activation key.

$user_login

(string) (Required) The username for the user.

$user_data

(WP_User) (Required) WP_User object.

Source

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

	function bp_email_retrieve_password_message( $message, $key, $user_login, $user_data ) {

		if ( is_multisite() ) {
			$site_name = get_network()->site_name;
		} else {
			/*
			 * The blogname option is escaped with esc_html on the way into the database
			 * in sanitize_option we want to reverse this for the plain text arena of emails.
			 */
			$site_name = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
		}

		$message = '<p>' . __( 'Someone has requested a password reset for the following account:', 'buddyboss' ) . '</p>';
		/* translators: %s: site name */
		$message .= '<p>' . sprintf( __( 'Site Name: <b>%s</b>', 'buddyboss' ), $site_name ) . '</p>';
		/* translators: %s: user login */
		$message .= '<p>' . sprintf( __( 'Username: <b>%s</b>', 'buddyboss' ), $user_login ) . '</p>';
		$message .= '<p>' . __( 'If this was a mistake, just ignore this email and nothing will happen.', 'buddyboss'  ) . '</p>';
		$message .= '<p>' . sprintf( __( 'To reset your password <a href="%s">Click here</a>.', 'buddyboss' ), network_site_url( "wp-login.php?action=rp&key=$key&login=" . rawurlencode( $user_login ), 'login' ) ) . '</p>';

		$message = bp_email_core_wp_get_template( $message, $user_data );

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

		return $message;
	}

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.