Jump to content
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

  • Similar Content

    • By Kian
      The hook assigns clients to groups based on the number of active domains in their accounts (Active, Grace and Redemption). This is particularly useful for Domain Pricing slabs. Let's take this code as example.
      $groups['1'] = '10'; $groups['2'] = '25'; $groups['3'] = '100'; The key of $groups array (eg. ['1']) represents the ID of the group while the value the number of active domains. According to the above configuration, here is what happens:
      Customer A has 10 domains. He goes to client group ID 2. Next day domains become 9. The the customer is removed from the group Customer B has 99 domains. He still goes to client group ID 2 but will be moved to 3 in case he manages to reach 100 domains Customer C has 250 domains. Group ID 3 The hook runs with WHMCS daily cron job meaning that customers are moved (or removed) from groups on a daily basis. Optionally, you can use the following feature to add some restrictions:
      $activeCustomers rules apply only on Active customers (boolean true or false) Get the Code »
    • By Kian
      When the status of a support ticket changes, WHMCS doesn't send any notification. We can tweak this process by sending an email and optionally also automatically add a reply to the ticket itself. This way you can guide customers through the resolving process letting them track the progress of tickets.
      Get the Code »
    • By bakiiwa
      Hi Everyone,
      My name is Bakiiwa and I am new here. I am not sure if this would be the appropriate community for my question (if not, please direct me and thanks in advance).
      I was wondering if anyone knows how to hide - other than making them optional, certain fields of the registration form? for example, I only wanted to collect Username/Email address and password input from the customer/client and after the client registers, they would have to confirm their email address and upon their sign in, to make it mandatory for them or keep a notification open for them to complete all the other profile fields within the client area?
      I read somewhere that there was/is a way to accomplish that by defining a value as N/A or notavailable and "hidden"  but that doesnt work for me, I am using WHMCS v 7.10.2.
      Any ideas might help.
      I am looking forward to learning from anyone.
      Thanks,
      Bakiiwa
    • By Kian
      If you have a bit of experience with WHMCS, you know that offering promotions just via coupon codes isn't so flexible.
      Many prefer to have products/services created specifically for special deals. Similarly others want to restrict domain purchase to customers with at least a product/service in their accounts. The hook lets you achieve both goals. Simply configure the following variables:
      $onetimeProducts array of product IDs to treat as "one-off" (customer is not allowed to order the same product multiple times) $onetimeProductGroups same as above but for product group IDs. Producs inside such groups are treated as one-off $firstTimerTollerance product-based restrictions are disabled for new customers placing their first order with you $notRepeatable if a customer already has a one-off product, he can't purchase further one-offs ($firstTimerTollerance is ignored) $domainRequiresProduct domain purchase is allowed only if any of the following conditions is met: Customer has an existing product/service (Pending and Terminated don't count) Customer is purchasing a domain and a product/service $promptRemoval notify customer about restrictions via (previews are below): bootstrap-alert right below Review & Checkout modal on screen js-alert on scren $textDisallowed message displayed for product-based restriction $textRequireProduct message displayed for domain-based resrticion When the hook detects that the customer is not allowed to order specific products/services and/or domains, it removes them from WHMCS cart showing alerts.

      Get the Code »
       
    • By Kian
      Yes, WHMCS integrates Bulk Pricing Updater but it works for all existing customers. Sometimes you simply need to recalculate prices for domains and products/services of a specific customer. This hook allows to do that in one click. First it adds the following button in client Summary.

      Second it shows this modal on screen where you can freely choose to auto-recalculate domains or products/services.

      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