Jump to content

Client to Group based on Registration Date


Kian

Recommended Posts

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

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated