Skip to content

Function

Filter the contents of the welcome user email.

tml_ms_filter_welcome_user_email( string $message, int $user_id, string $password )

Parameters

$message string
The welcome user message.
$user_id int
The user ID.
$password string
The user password.

Return

string The welcome user message.

Source

function tml_ms_filter_welcome_user_email( $message, $user_id, $password ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed -- required by the 'update_welcome_user_email' filter's positional signature; the password is substituted via the 'PASSWORD' placeholder token instead.
    $user            = get_userdata( $user_id );
    $chosen_password = tml_ms_get_activation_password();
    if ( '' !== $chosen_password ) {
        $message = str_replace( 'PASSWORD', $chosen_password, $message );
    }
    if ( tml_is_email_login_type() ) {
        $message = str_replace( 'USERNAME', $user->user_email, $message );
    }
    return $message;
}

Uses

Changelog

VersionDescription
7.0 Introduced.