Support » Plugin: Ultimate Member – User Profile, User Registration, Login & Membership Plugin » Disable Registration Emails for certain User Role

  • Resolved fotan

    (@fotan)


    I have a project that has a number of custom user roles. One of which they would like to disable all the emails that are sent when a user is registered with one particular role. Is this possible?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Aswin Giri

    (@aswingiri)

    Hello @fotan

    Ultimate member does not have this feature builtin but you can try out following code snippet:

    add_action( 'um_before_email_notification_sending', function( $email, $template, $args ){
    
    	$user = get_user_by( 'email', $email );
    	um_fetch_user( $user->ID );
        if ( UM()->user()->get_role() == 'custom-role-id' && 'welcome_email' == $template ) {
            return;
        }
    
    },10, 3 );

    Please remember to replace custom-role-id with the actual role ID you would like to prevent welcome email for. If you are not sure about the Role ID, you can check that on wp-admin > ultimate member > User Roles on Role ID column.

    Regards,

    • This reply was modified 2 weeks, 4 days ago by Aswin Giri.
    Thread Starter fotan

    (@fotan)

    That works. Thanks much.

    Plugin Support Ultimate Member Support

    (@ultimatemembersupport)

    Thanks for letting us know how it resolved the issue.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.