how to desactivate mail notifications if

  • Posted 3 weeks ago

hello
I’d like to do not send email notification :
– once user is verified
– if user role is “particulier”

I tried various code, but nothing work.

add_action( ‘voxel/app-events/post-types/profile/post:updated’, function( $event ) {

$post_id = $event->post_id ?? null;
if ( ! $post_id ) return;

$author_id = get_post_field( ‘post_author’, $post_id );
if ( ! $author_id ) return;

// Vérifier le rôle de l’auteur
$user = get_user_by( ‘id’, $author_id );

if ( $user && in_array( ‘particulier’, (array) $user->roles ) ) {
return; // stop => ne pas envoyer de mail
}

// — Ici tu mets ton code d’envoi de mail —
});

–> this is not working and I cannot find the way to check is user is verified or not

thx for your help !