Untitled
webwizards
plain_text
a month ago
825 B
3
Indexable
add_filter('woocommerce_email_recipient_b2bking_new_message_email', 'b2bking_filter_conversation_email_recipients', 1000, 2); function b2bking_filter_conversation_email_recipients($recipient, $order) { // If no recipient, return empty if (empty($recipient)) { return $recipient; } // Check if the recipient is an admin or shop manager $user = get_user_by('email', $recipient); if ($user) { // Check if user has admin or shop manager capabilities if (user_can($user, 'manage_options') || user_can($user, 'manage_woocommerce')) { // User is admin or shop manager, allow email return $recipient; } else { // User is not admin/shop manager, block email return ''; } } else { return ''; } }
Editor is loading...
Leave a Comment