# Some free WHMCS Hooks you might find useful.



## KuJoe (Apr 18, 2015)

Figured I'd post these here since some of these are pretty helpful.

invoiceAddCredit - WHMCS hook to automatically add a percentage of credits based on payment processor. _*(Inspired by )*_

chkClientDetails - A WHMCS hook that checks new client details for blocked words and displays an error if such words exist in any of the client fields. _*(Inspired by this thread.)*_

Extended-Login-Tracker - A WHMCS addon that records all IPs that login and makes them searchable (adapted from 2 different scripts). _*(Inspired by )*_

IP_to_Domain - A simple WHMCS hook that replaces a services domain to the dedicated IP assigned to it during service creation (great for VPS services when you want to search for who has had a specific IP in the past and for identifying services since domains in WHMCS don't update for most VPS control panels when hostnames change). _*(Holy smokes an original!)*_

closeFraud - A simple WHMCS hook to automatically close accounts who are marked Inactive and only have fraudulent orders. If an account has order marked as Fraud but also has an order not marked as fraud, the account is skipped. Runs after WHMCS's daily cron. _*(Holy smokes an original!)*_

chkProxy - A simple WHMCS hook that checks if the client is using a proxy/VPN prior to ordering (saves tickets and time). _*(Holy smokes an original!)*_

As you can see I get some original ideas sometimes but I'm always looking for inspiration so if you have any ideas or requests feel free to post them here and I'll see what I can do.


----------



## Nett (Apr 18, 2015)

Great scripts! May I request FraudRecord checks after ordering? AfterFraudCheck might be the hook to use .


----------



## Syntrel (Apr 18, 2015)

Great post, keep them coming.


----------



## MannDude (Apr 18, 2015)

Thanks for sharing @KuJoe, you da man!


----------



## mitgib (Nov 16, 2015)

@KuJoe I was searching for this post when I had the idea you have made a hook that issued credit on cancel and went and looked through https://github.com/KuJoe but I was mistaken.  Can I inspire you yet again?  I was thinking, along the same lines at BuyVM, when a customer cancels service and choses immediate, any remaining time is credited as account credit. When they chose end of billing period, obviously there is no credit due.


I had thought this was built in since downgrades do the same thing, but I either missed it in the settings or I am looking for something @Aldryic C'boas hooked for BuyVM


----------



## KuJoe (Nov 19, 2015)

mitgib said:


> @KuJoe I was searching for this post when I had the idea you have made a hook that issued credit on cancel and went and looked through https://github.com/KuJoe but I was mistaken.  Can I inspire you yet again?  I was thinking, along the same lines at BuyVM, when a customer cancels service and choses immediate, any remaining time is credited as account credit. When they chose end of billing period, obviously there is no credit due.
> 
> 
> I had thought this was built in since downgrades do the same thing, but I either missed it in the settings or I am looking for something @Aldryic C'boas hooked for BuyVM



I pushed this to my GitHub but I haven't had time to test it. If somebody else has a development WHMCS they want to try it out in it would be appreciated because my dev setup is in use at the moment for other testing and I don't want to test multiple modules/hooks/addons at once.


https://github.com/KuJoe/cancelledCredit


----------



## mitgib (Nov 23, 2015)

KuJoe said:


> I pushed this to my GitHub but I haven't had time to test it. If somebody else has a development WHMCS they want to try it out in it would be appreciated because my dev setup is in use at the moment for other testing and I don't want to test multiple modules/hooks/addons at once.
> 
> 
> https://github.com/KuJoe/cancelledCredit



I tried this out since I had 1 immediate cancel this morning, changed the $admin user to a valid admin, no credit posted. Sorry I am unable to provide any other details, looking at the detailed cron report has nothing to add. Will wait until you are able to try your test environment.


----------



## qps (Feb 22, 2016)

KuJoe said:


> chkProxy - A simple WHMCS hook that checks if the client is using a proxy/VPN prior to ordering (saves tickets and time). _*(Holy smokes an original!)*_





We've been using this for a while and it has been working great, but I think recently MaxMind may have changed the way that they process queries, because now I am seeing a score of 0.00 being returned with an error, which gives an error in the script and prevents users from ordering.  Anyone else seeing this?


----------



## KuJoe (Feb 22, 2016)

qps said:


> We've been using this for a while and it has been working great, but I think recently MaxMind may have changed the way that they process queries, because now I am seeing a score of 0.00 being returned with an error, which gives an error in the script and prevents users from ordering.  Anyone else seeing this?



What error are you seeing? I'll review their API and see if they changed anything.


----------



## qps (Feb 22, 2016)

KuJoe said:


> What error are you seeing? I'll review their API and see if they changed anything.



It says "city not found" when I click through to review the query.  I'm not sure if that what is causing the issue or not.


----------



## KuJoe (Feb 23, 2016)

That's really strange, it shouldn't be checking the city since it's just their proxy check. Are you sure you have the Proxy Detection credits and not just the minFraud credits?


----------



## qps (Feb 23, 2016)

KuJoe said:


> That's really strange, it shouldn't be checking the city since it's just their proxy check. Are you sure you have the Proxy Detection credits and not just the minFraud credits?



Yes, these are the same proxy check credits I've been using all along.  They only recently started throwing this error.


----------



## UltratechHost (Feb 23, 2016)

Hi,


From the source code or date of update for InvoiceAddCredit it looks like is from WHMCS 5 not for WHMCS 6.X


So can you please confirm whether they works with WHMCS 6.X


----------



## KuJoe (Feb 23, 2016)

UltratechHost said:


> Hi,
> 
> 
> From the source code or date of update for InvoiceAddCredit it looks like is from WHMCS 5 not for WHMCS 6.X
> ...



It will work with WHMCS 6.x until they disable the SQL Helpers.


----------



## kevinsimmons (Apr 1, 2016)

Great man ! Thank you for sharing, they are definitely more helpful


----------



## kunnu (Apr 4, 2016)

Login IP tracker and Proxy IP checker is really very useful however using hooks is really harmful because of I was use "chkClientDetails" type script for avoiding spam tickets but even ticket of some customers was blocked so I stop using this hooks.


----------



## KuJoe (Apr 4, 2016)

kunnu said:


> Login IP tracker and Proxy IP checker is really very useful however using hooks is really harmful because of I was use "chkClientDetails" type script for avoiding spam tickets but even ticket of some customers was blocked so I stop using this hooks.



It shouldn't have anything to do with tickets unless WHMCS forgot to update their documentation for the ClientDetailsValidation hook:



> This is run when before adding a client or updating a client through the Admin or Client area.


----------



## Hosterbox (Apr 6, 2016)

Thanks for the post!


----------



## WSH_DNYT (Dec 12, 2016)

thank you for sharing.


The Discount on payment gateway used is interesting as you could reward ppl paying with bitcoin (less cost on our side)


----------



## rcchost (May 1, 2022)

This is very helpful. Thank you for sharing.


----------



## greenwebpage (May 29, 2022)

thank you for sharing.


----------

