Skip to content

Instantly share code, notes, and snippets.

@nikitasinelnikov
Last active June 8, 2023 18:22
Show Gist options
  • Save nikitasinelnikov/d01b05cf61bc917675ed28e529c562f4 to your computer and use it in GitHub Desktop.
Save nikitasinelnikov/d01b05cf61bc917675ed28e529c562f4 to your computer and use it in GitHub Desktop.
Ultimate Member: Disable sending email by a user role
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