Jump to content
Sign in to follow this  
Kian

Client to Group based on Registration Date

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 »

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Similar Content

    • By Eldremor
      Hello again!
      The title says everything. I found a hook on github but it's not working so I'm here to ask for help 😊
      I hope this topic help a lot of people.
    • By Kian
      Restrict the access to support departments based on the products purchased by users. Define rules as follows.
      $department['1'] = array('45', '46', '10'); $department['2'] = array('85', '86', '10'); // Keep adding rules one per line The key of $department array (the [1] and [2] between square brackets) corresponds to the ID of the support department for which we are creating a rule. The value is an array() of product IDs required for access. In a in nutshell, the above configuration unlocks department #1 to users with product IDs 45, 46 and 10. Department #2 requires 85, 86 and 10.
      Here are few more things to consider:
      submitticket.php doesn't show restricted departments Access via direct link submitticket.php?step=2&deptid=2 triggers a redirect to submitticket.php Department dropdown lists only allowed department The same product can be used for multiple rules Pending, Suspended, Terminated, Cancelled and Fraud products are ignored Get the Code »
    • By digitalosaurus
      Hi guys.
      I am currently developing a filemanagement system. I want to deliver that product over the file download "module". the user needs to registrate for that. Now my question is, is it possible to sign-up for just this product only (no middlestep in the whmcs, to order it). Can you  tell me if there is some module, addon or similar to get that work?
      BR digitalosaurus
    • By Kian
      Client group background colors no longer display on ticket view page. Go figure out why WHMCS decided to remove it from v8. This action hook puts the styling back.

      Get the Code »
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • 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