1. Home
  2. Snippets
  3. Change user email for User Registration addon

Change user email for User Registration addon

Heads up!

This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.

For extra guidance, please see WPBeginner's tutorial on adding custom code.


When using the User Registration addon for WPForms, you’ll have the option to send the user an email that contains their login information and, if enabled, activation details.

Enable account info or activation email

If either option is enabled, the user will receive an email with their username and password, as well as your site’s login URL.

If Enable user activation is checked, this same email will also include additional details based on the method chosen:

  • User Email: End of email will include brief instructions and an activation link.
  • Manual Approval: End of email will let user know an admin must approve the user.

WPForms user activation email

The code below can be used to customize all content for this email, including any conditional content for user activation. For example, if line 17 was deleted, the password would no longer be included in the email.

 * Change user email for the User Registration addon.
 * @param array $email
 * @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 );


Updated on May 7, 2018

Was this article helpful?