The idea is to send an Email to a newly-registered Vendor.
However, since there seems to be no Email Event in HivePress for this, I am using a PHP snippet to send an Email to the user when their user role changes to ‘Contributor’.
The only problem now is that I need the snippet to send an Email I have created in HivePress → Emails. Any idea on how I can point the snippet to Emails in HivePress → Emails?
Here is the PHP snippet I am using:
function user_role_update( $user_id, $new_role ) {
if ( $new_role == 'contributor' ) {
$site_url = get_bloginfo( 'wpurl' );
$user_info = get_userdata( $user_id );
$to = $user_info->user_email;
$subject = 'Role changed: ' . $site_url . '';
$message = 'Hello ' . $user_info->display_name . ' your role has changed on ' . $site_url . ', congratulations you are now an ' . $new_role;
wp_mail( $to, $subject, $message );
}
}
add_action( 'set_user_role', 'user_role_update', 10, 2 );