Jump to content

Hook to set new client as active after accepting first order


stormy

Recommended Posts

Just today I found out that a new customer was set as Inactive. This is something I thought was fixed many versions ago, I have a distant memory of even having a custom hook that would set clients to active after their first order was accepted. The cron works correctly when setting clients as active/inactive, though.

I've searched the forums and the documentation and can't come up with a definitive answer.

  • Does WHMCS mark new clients as active, and there's something wrong with my install? I'm on 7.6.2 by the way.
  • If not, can somebody help me with a hook that does it?

In case it matters: I have the "Only Auto Provision for Existing" checkbox ticked, to always leave orders by new clients pending for manual review.

Thanks a lot!

Link to comment
Share on other sites

11 minutes ago, stormy said:

Just today I found out that a new customer was set as Inactive. This is something I thought was fixed many versions ago, I have a distant memory of even having a custom hook that would set clients to active after their first order was accepted. The cron works correctly when setting clients as active/inactive, though.

was it the cron that changed their status ?

it sounds as though they've made their first order, but haven't paid for it yet - so under those circumstances, the cron would change their status to inactive... I think that would apply to v7.6 too via the automation settings.

13 minutes ago, stormy said:

Does WHMCS mark new clients as active, and there's something wrong with my install? I'm on 7.6.2 by the way.

yes, new clients are active (so there's no issue with the install)... and they would stay active until either you, or WHMCS, changes their status.

14 minutes ago, stormy said:

If not, can somebody help me with a hook that does it?

it might not be necessary in the sense that...

  • clients won't know what their account status is - being classed as inactive wouldn't prevent them from logging in, paying invoices, ordering new services etc.
  • as soon as they have an active product etc, e.g when it's been paid (or marked as paid) and provisioned, then the cron will change their status overnight (or whenever the daily cron runs) to active.
  • you haven't reached v7.7 yet, so you won't have run into the exciting (*sarcasm fully enabled*) "Hide Inactive Clients" issues.

technically, it would be an AcceptOrder hook that updates the tblclients table (either via a query or an UpdateClient API call) - but if the cron is changing the status of those with no active products/domains etc, then it will switch it back to Inactive.

Link to comment
Share on other sites

Thanks for the quick reply, Brian! Let me clarify:

1 hour ago, brian! said:

was it the cron that changed their status ?

Ok I got it! She ordered before the cron run, but was activated after it. So it WAS the cron that changed the status to inactive. And that also means that the manual accepting of the order does not mark the client as active, only the daily cron does. 

I know it's not a problem except that I like to look at my new clients of the day, and if they are not active, I won't see them till the next day.

1 hour ago, brian! said:

technically, it would be an AcceptOrder hook that updates the tblclients table

Any hints on how to code this?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • 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