Last active
June 8, 2023 18:22
-
-
Save nikitasinelnikov/d01b05cf61bc917675ed28e529c562f4 to your computer and use it in GitHub Desktop.
Ultimate Member: Disable sending email by a user role
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function um_custom_disable_by_role( $disable_sending, $email, $template, $args ) { | |
$user = get_user_by( 'email', $email ); | |
if ( user_can( $user, '{necessary_role_for_disable}' ) ) { | |
$disable_sending = true; | |
} | |
return $disable_sending; | |
} | |
add_filter( 'um_disable_email_notification_sending', 'um_custom_disable_by_role', 10, 4 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment