John Kennedy Posted December 18, 2017 Share Posted December 18, 2017 Hi, Can't seem to find an answer to this. I need to disable payment reminders for the customers who have a standing order set up to pay us on invoice date. Some are getting annoyed they are getting these reminders. Link to comment Share on other sites More sharing options...
John Kennedy Posted December 18, 2017 Author Share Posted December 18, 2017 Why is there no "edit" option? Sigh... Would be nice to have "per customer" automation options. What I'm looking to do is to stop "Invoice Unpaid Reminders" from going out to certain customers. I'm guessing this is achievable with a hook, but I can't find anything with "Client ID" on it. Link to comment Share on other sites More sharing options...
WHMCS Support Manager WHMCS John Posted December 27, 2017 WHMCS Support Manager Share Posted December 27, 2017 Hi @John Kennedy, At present overdue reminders can be disabled on a per-account basis, but not other invoice emails. There are some existing feature requests with a handful of votes thus far, so please do add yours: https://requests.whmcs.com/topic/disable-payment-reminder-notifications-on-a-per-account-basis https://requests.whmcs.com/topic/disable-invoice-reminders-as-a-client Link to comment Share on other sites More sharing options...
brian! Posted January 10, 2018 Share Posted January 10, 2018 On 12/18/2017 at 16:48, John Kennedy said: What I'm looking to do is to stop "Invoice Unpaid Reminders" from going out to certain customers. I'm guessing this is achievable with a hook, but I can't find anything with "Client ID" on it. you could try modifying the hook in the thread below.... it should just be a case of modifying the values of $client_ids and $message_names - ultimately, i'll have to be rewrite it and replace the SQL code (e.g convert it to SQL) - simple enough task, but the above hook should work until at least v8 (which is probably 6 months away at least). Link to comment Share on other sites More sharing options...
John Kennedy Posted March 16, 2018 Author Share Posted March 16, 2018 Thanks brian!, that's just what I was looking for. Seems to be working for the test client. I'm assuming I can stop any type if email from being sent by modifying the $client_ids and $message_names arrays. That kind of creates a second question: If I want to stop 3 templates from going to 2 customers, but only 2 templates to the 3rd customer. Would I have to set up a different hook for the 3rd customer or would that conflict with the original hook? Link to comment Share on other sites More sharing options...
brian! Posted March 17, 2018 Share Posted March 17, 2018 Hi John, 17 hours ago, John Kennedy said: I'm assuming I can stop any type if email from being sent by modifying the $client_ids and $message_names arrays. yes. 17 hours ago, John Kennedy said: If I want to stop 3 templates from going to 2 customers, but only 2 templates to the 3rd customer. Would I have to set up a different hook for the 3rd customer or would that conflict with the original hook? oooh my head! short answer is there won't be any conflict if you use two hooks correctly. better answer would be to write the hook in such a way that you control which users don't get which templates... so if you tweak the updated code posted by @sentq from the thread below... <?php use WHMCS\Database\Capsule; add_hook("EmailPreSend", 1, function($vars){ if ($vars['messagename'] === "Invoice Payment Reminder"){ $getClientId = Capsule::table("tblinvoices")->where("id", $vars['relid'])->first(); if (in_array($getClientId->userid, array(1, 12, 25))){ return array("abortsend" => true); } } elseif ($vars['messagename'] === "Invoice Created"){ $getClientId = Capsule::table("tblinvoices")->where("id", $vars['relid'])->first(); if (in_array($getClientId->userid, array(1, 12))){ return array("abortsend" => true); } } }); so you can go through each template and define who won't receive those particular emails... you can tidy this up a lot and group templates together, but my head still hasn't recovered from your 3 templates to 2, and 2 templates to three... Link to comment Share on other sites More sharing options...
Recommended Posts