Filter uncanny-learndash-toolkit

uo_verified_email_message

Filters message of user verification email sent to admin. Filters the user verification email message sent to the admin after a user is verified.

add_filter( 'uo_verified_email_message', $callback, 10, 1 );

Description

Filters the content of the email sent to the admin when a user's email is verified. Developers can modify the email's subject, body, or any other message component. This hook fires after a user's email has been verified but before the email is sent to the administrator.


Usage

add_filter( 'uo_verified_email_message', 'your_function_name', 10, 1 );

Return Value

The filtered value.


Examples

add_filter( 'uo_verified_email_message', 'my_custom_verified_email_message', 10, 2 );

/**
 * Customizes the email message sent to the admin when a user's email is verified.
 *
 * @param array $message The original email message content.
 * @param WP_User $user The user object for the verified user.
 * @return array The modified email message content.
 */
function my_custom_verified_email_message( $message, $user ) {
	// Assuming $message is an array with keys like 'subject' and 'body' or similar.
	// Let's add a custom note to the body.

	if ( is_array( $message ) && isset( $message['body'] ) ) {
		$message['body'] .= "nn";
		$message['body'] .= sprintf(
			__( 'This is a custom notification for user "%s" (ID: %d) whose email address has just been verified.', 'my-text-domain' ),
			$user->user_login,
			$user->ID
		);

		// Optionally, you could also modify the subject if it's part of the array.
		// if ( isset( $message['subject'] ) ) {
		// 	$message['subject'] = '[Custom Notification] ' . $message['subject'];
		// }
	} elseif ( is_string( $message ) ) {
		// If the message is a string, append to it directly.
		$message .= "nn";
		$message .= sprintf(
			__( 'This is a custom notification for user "%s" (ID: %d) whose email address has just been verified.', 'my-text-domain' ),
			$user->user_login,
			$user->ID
		);
	}

	return $message;
}

Placement

This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.


Source Code

src/classes/frontend-login-plus.php:1522
src/classes/frontend-login-plus.php:1568

/**
			 * Filters message of user verification email sent to admin.
			 *
			 * @param array $message The email message.
			 * @param WP_User $user The verified user.
			 */
			$message = apply_filters( 'uo_verified_email_message', $message, $user );

			$admin_mailed = wp_mail( $to, $subject, $message, $headers );

			// after wp_mail successful.
			if ( $admin_mailed && $mailed ) {

				update_user_meta( $user_id, 'uo_verified_email_sent', 'yes' );


Scroll to Top