zitu4life Posted May 17, 2020 Share Posted May 17, 2020 Hello there Wile waiting for a third module setting up, I am looking if any hook can do this workaround and can get me closer. I want to create new client group (ex. named IT2020), and have a hook that prevents 3 things: 1 - (prevent that message to sent out, even if I forgot to un-tick it) 2 - (Auto disallow single sign-on, even if it get tick) 3 - (Auto disallow Marketing email even if it get tick) Actually I do not know if even hook can abort those specific action at ounce based on client group 😷 PS: hook should work based on client group IT2020. thank you! 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted May 18, 2020 Share Posted May 18, 2020 <?php use WHMCS\Database\Capsule; add_hook('EmailPreSend', 1, function($vars) { $disallowedGroupID = '1'; // Insert Client Group ID $emailTemplates = array('Automated Password Reset', 'Password Reset Validation', 'Password Reset Confirmation'); // Email Templates to block if (in_array($vars['messagename'], $emailTemplates)) { if (!Capsule::select(Capsule::raw('SELECT id FROM tblclients WHERE id = "' . $vars['relid'] . '" AND groupid = "' . $groupid . '" LIMIT 1'))) { $output['abortsend'] = true; return $output; } } }); This will block any email template you want but at the moment I can't remember how to block Marketing & Sign-On emails. 1 Quote Link to comment Share on other sites More sharing options...
adinase Posted October 22, 2020 Share Posted October 22, 2020 Followed as advised used the following code and it was working until august Not sure why it is not working now Can u please help us here Code : https://pastebin.com/ae734QU4 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.