/**
* Automatically disable notifications for users without the 'Niveau-3' tag.
*/
add_action( 'init', function() {
// Check if the 'wpf_has_tag' function exists before proceeding
if ( ! function_exists( 'wpf_has_tag' ) ) {
return;
}
// Get all users
$users = get_users();
// Loop through each user
foreach ( $users as $key => $user ) {
// Check if the user does not have the 'Niveau-3' tag
if ( ! wpf_has_tag( 'Niveau-3', $user->ID ) ) {
// Update the user's meta to disable notifications
update_user_meta( $user->ID, 'enable_notification', 'no' );
}
}
});
Comments