Description

Filters email properties for new user emails sent from the User Registration Addon.

Parameters

$emails
(array) (Required) Properties of the email that will be generated.

Source

wpforms-user-registration/class-user-registration.php

More Information

The wpforms_user_registration_email_user filter is applied to an array containing email data, prior to the User Registration Addon sending the new user email. It can be used to customize the properties of the email including the message sent to the user.

Example

/**
 * Filters email properties for new user emails sent from the User Registration Addon. 
 *
 * @link   https://wpforms.com/developers/wpforms_user_registration_email_user/
 *
 * @param  array $emails
 * @return array
 */
function wpf_dev_user_registration_user_email( $email ) {

	$blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );

	// Set the email subject line
	$email['subject']  = sprintf( __( '[%s] Your username and password info' ), $blogname );

	// The primary part of the email message consists of providing the user
	// with their username, password, and login URL.
	$email['message'] = sprintf( __( 'Username: %s' ), $email['user']->user_login ) . "\r\n";
	$email['message'] .= sprintf( __( 'Password: %s' ), $email['password'] ) . "\r\n\r\n";
	$email['message'] .= wp_login_url() . "\r\n\r\n";

	// Add more details if to the email message if user activation is enabled
	if ( $email['activation'] ) {

		// Append "Activation Required" to the existing email subject line
		$email['subject'] .= __( ' (Activation Required)', 'wpforms_user_registration' );

		// If activation method is User Email
		if ( 'user' == $email['activation']  ) {
			$email['message'] .= __( 'IMPORTANT: You must activate you account before you can login. Please visit the link below.', 'wpforms_user_registration' ) . "\r\n";
			$email['message'] .= $email['link'];
		// If activation method is Manual Approval
		} else {
			$email['message'] .= __( 'Site administrator must activate your account before you can login.', 'wpforms_user_registration' ) . "\r\n";
		}
	}

	return $email;
}
add_filter( 'wpforms_user_registration_email_user', 'wpf_dev_user_registration_user_email', 10, 1 );

Snippet Reference: Change User Email for User Registration Addon