WP welcome email depending on user role

I’m looking for a way to customize the welcome email, ONLY for new users with a certain role. (I use the Gravity Form User Registration Add-On to allow visitors to vote, thereby registering as “Voter”.)

I’ve managed to customize the email for all new users:

Read More
function customize_activation_email_voter($message) {
return 'To confirm your vote, click on the following link: %s';
}
add_filter('wpmu_signup_user_notification_email', 'customize_activation_email_voter', 20, 2);

But not for only “Voters”.

One problem is that there is no regular user metadata stored in the WP database yet, because technically, the user is not yet a user – that happens only after activation (in my case, confirmation of the vote).

Is there a way to get the user’s role before the activation of their account?

Related posts

1 comment

  1. Roles are assigned by the admin (or automatically by some theme or plugin) and therefor can not be assigned before the user is manageable by the admin, which doesn’t happen before all the activation stages are completed. Therefor there is not enough info at the signup stage about the user role and you need to have to supply it in the form. You can have a role selection input or just use different forms for different roles.

Comments are closed.