Kian Posted September 10, 2020 Share Posted September 10, 2020 This hook is similar to the one that assigns clients to groups based on purchases. This time we're assigning clients to groups based on registration date or more precisely on user seniority. Let's take this code as example. $groups['1'] = '90'; $groups['2'] = '180'; $groups['3'] = '365'; They key of $groups array (eg. ['1']) represents the ID of the group while the value user seniority (days between registration date and current date). According to the above configuration, here is what happens: Customer A registered 34 days ago. No change Customer B registered 90 days ago. He goes to client group ID 2 Customer C registered 364 days ago. Still group ID 2 Customer D registered 500 days ago. He goes to client group ID 3 Optionally, you can turn on any of the following features to add some restrictions: $activeCustomers rules apply only on Active customers (boolean true or false) $oldestPurchase rules apply only on if customer has a product/service or domain older than the given number of days (integear) The hook runs with WHMCS daily cron job meaning that tomorrow the customer C of the above example will move from group 2 to 3. Get the Code » Link to comment Share on other sites More sharing options...
Kian Posted September 11, 2020 Author Share Posted September 11, 2020 The script has been updated to include the following new options: $ignoreDomains set true to ignore domain purchases when $oldestPurchase is in use $ignoreProducts array of product IDs to ignore when $oldestPurchase is in use Link to comment Share on other sites More sharing options...
Recommended Posts