Jump to content


Popular Content

Showing most liked content since 03/14/2018 in all areas

  1. 2 points
    they should be able to see it in their notfications dropdown in the header... alternatively, @sentq posted a sidebar hook to show the credit balance... and I posted how to add it as a homepage panel...
  2. 1 point
    When it comes time to order a hosting plan, sometimes you don't want your users to be able to enter in a subdomain when using an existing domain for their order. In this post I am going to walk you through a basic hook that prevents entering a subdomain by using some client-side JavaScript. Our first order of business will be to check out the WHMCS hooks index to see if there is a hook point that will fit our needs: https://developers.whmcs.com/hooks/hook-index/ It turns out, the ClientAreaFooterOutput hook will do nicely: https://developers.whmcs.com/hooks-reference/output/#clientareafooteroutput The reason for this is because that hook point will allow you to inject HTML code, which also can contain JavaScript, into the client-side template so you can make the magic happen. Before getting into more detail, let's go ahead and dive right into the code. You can also download it from this link block_subdomains.txt (then rename the extension to .php). Here is the entire snippet: <?php add_hook('ClientAreaFooterOutput', 1, function($vars) { $jqueryCode = '<script> $("#owndomainsld").on("keyup", function(e) { var str = $("#owndomainsld").val(); if ( str.indexOf(".") != -1 ) { $("#owndomainsld").val(""); alert("Subdomains are not allowed!"); } }); </script>'; if (strpos($_SERVER['REQUEST_URI'], 'cart.php') !== false ) { return $jqueryCode; } }); The first thing to notice is the add_hook function is being called with the ClientAreaFooterOutput hook point as the first argument and an anonymous function as the second argument. The anonymous function also has a $vars variable being passed into it. For this example the $vars variable is not actually being used in the body of the function, but it does contain some useful parameters should you need to access them. Those parameters can be found in the documentation for the hook point linked above. The next thing to notice is the $jqueryCode variable. which is actually a PHP string that contains the JavaScript code we will be injecting into our client-side page. Since WHMCS uses the jQuery JavaScript library and loads it on the page, we can use it in our code. First, we need to bind an event listener to the keyup event on the domain text box and provide it a callback function to execute when that event occurs. This can be easily done by targeting the element's HTML ID attribute. That is what is happening here: $("#owndomainsld").on("keyup", function(e) {... After that, the value of the domain text field is stored in a JavaScript variable called str. Since this code is inside our callback function, it will be executed every time the user presses a key on the keyboard and then releases it: var str = $("#owndomainsld").val(); Once we have that text stored in our str variable, we need to check it for a dot or period '.' character to see if it is a subdomain. This can be done with indexOf string function in JavaScript. If the text appears to be a subdomain, we'll go ahead and empty out the text field and then show an alert to the user to let them know that subdomains are not allowed: if ( str.indexOf(".") != -1 ) { $("#owndomainsld").val(""); alert("Subdomains are not allowed!"); } Finally, the last part of the hook does a case-insensitive string search on the $_SERVER['REQUEST_URI'] (the URL of the page you're visiting), to check and see if a cart page is being rendered. If a cart page is detected, the JavaScript code is injected into that page so it can run. if (strpos($_SERVER['REQUEST_URI'], 'cart.php') !== false ) { return $jqueryCode; } Putting it all together, we get the final results in WHMCS which look like the picture here: I hope this post proved helpful and gives some insight on some of the ways that WHMCS can be extended to do many different things outside the box! At the time of writing this post, this hook was tested on the latest stable release of WHMCS 7.4.2 and should work with any that fall under Active Support as per the LTS schedule here: https://docs.whmcs.com/Long_Term_Support#WHMCS_Version_.26_LTS_Schedule If you have any feedback, questions, or concerns that I did not cover in this post, please feel free to reach out!
  3. 1 point
    I knew the core solution was mine, but it just saves me time if someone sees your screenshot and asks how to do it... I can link to your post now!
  4. 1 point
    Hi everyone, Its been a long time since i have been around and mostly due to medical and life issues. However since i have decided to retire from the professional side of programming and just doing the hobby deal now i wanted to offer up my old WHMCS addons (not encoded) to everyone for free. I wont be doing any more WHMCS work now that its just a hobby for me so sharing what i have done in the past might help someone in the future, so you may download an use them as you wish. You are free to use these addons without restriction from me, all i ask is that somewhere in the header you at least be kind enough to mention my name as the original artist. I believe that last version i updated these for was WHMCS version 6 and they all worked back then. You may have to do some tweaking for the newer versions of WHMCS. I will be posting several zip files here over the next few days as soon as i can get the file headers modified for the new non restrictive purposes, i believe there are a total of 4 addons i will be posting here. The zip file contains the install txt and all the files you need. It is exactly the way it was when it was for sale, the only thing i have changed are the files license header to unrestricted. Thanks for all your help in the past and i wish you all the very best going forward. 1. This one is called Client Permblock - The purpose of this addon is to give the local admin a way to locally block unwanted clients. With WHMCS there are national fraud features that you would typically report fraud clients to as part of WHMCS. However, if that client should not qualify to be reported to those national companies for some reason then this addon will allow you to keep your own local records. This addon does not do any remote reporting, its only purpose is to allow you to be more proactive and list current WHMCS clients or add non-client information that you choose not to do business with in the future should they attempt to join your business as a client. I had big plans for this addon with more features but just never got around to it. Enjoy the addon client_permblock_addon_V1_1_free.zip 2. This is the PHPBB Bridge addon - This addon allows you to auto register a new WHMCS client to your phpBB community when they complete the WHMCS registration. Enjoy the addon phpbb_bub_addon1_4_free.zip
  5. 1 point
    that's really disappointing to hear... Admin Friendly URLs is one of those new features they brought in with no great clamour from users for them to add it (I believe)... though sadly there are plenty more examples of them doing that! I don't necessarily mind that Support couldn't solve it immediately themselves, but at the very least, they should have passed it up the chain so that others (developers, testers etc) knew an environment with x,y,z was having such problems. perhaps you could post your ticket ID in this thread and one of the WHMCS staff may take another look at the ticket.
  6. 1 point
    at least for the time being. it might be worth opening a ticket with support, explaining the problem and that you think Friendly URLs are the cause.... and expanding on your specific environment because it's not a problem that every user has, only specific ones and it would be helpful for WHMCS to determine common factors as to why this isn't working for you. at best, this may get added to v7.5 (but nothing in changelog yet)... but to be honest, you're probably better off sticking with Basic URLs until this gets resolved.... it's a relatively new feature, and sadly from experience, will probably remain bugged for a few more releases yet.
  7. 1 point
    there was a similar thread about another client dropdown not working... I wonder if your issue is caused by a Friendly URLs setting too?
  8. 1 point
    then add @cyben76 code above and that will fix it.
  9. 1 point
    Welcome to WHMCS.Community Rose Edwards! We're glad you're here please take some time to familiarise yourself with the Community Rules & Guidelines and take a moment to introduce yourself to other WHMCS.Community members in the Introduce Yourself Board.
  10. 1 point
    notifications are an absolute pain to code - how many notification hooks have you ever seen posted in this place? precisely.
  11. 1 point
    for the INS in webhook try using http instead of https. It worked for me. So instead of https://www.xxxxxx.com/clients/modules/gateways/callback/tco.php use http://www.xxxxxx.com/clients/modules/gateways/callback/tco.php
  12. 1 point
    For anyone with a similar error, I found out what was wrong. When I added the cPanel module in applications links, I got log warnings : API failure: You do not have access to an account named “name-of-account” I compared the name-of-account part with the one I had in WHM, and they were registered wrong on WHMCS, I entered the right cpanel username and everything works now.
  13. 1 point
    You can do it through the client's profile page. Find the dropdown menu with "active" "inactive" and "closed"

Important Information

By using this site, you agree to our Terms of Use & Guidelines