Jump to content

Search the Community

Showing results for tags 'hooks'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • The latest WHMCS Release
  • WHMCS Beta Program
  • The Latest from the WHMCS Team
    • News & Announcements
    • The WHMCS Blog
  • WHMCS.Community
    • Community Announcements
    • Introduce Yourself
  • Using WHMCS
    • Pre-Sales Questions
    • Admin & Configuration Questions
    • Installation, Upgrade, and Import Support
    • Using WHMCS
    • Troubleshooting Issues
    • Vendor Discussions
  • WHMCS Showcase
    • Showcase Your Site
    • Share Your Best Practices & Tips
  • Developing & Extending WHMCS
    • Third Party Add-ons
    • Service Offers & Requests
    • Developer Corner
    • Building Modules
    • Share Ideas for WHMCS Modules
  • Community Competitions
    • Competitions
  • General Discussions
    • General Discussion
  • General Feedback & Assistance
    • WHMCS.Community Tips & Tricks
  • Third Party Developers's Topics
  • Turkish International Discussions's Topics
  • Russian International Discussions's Topics
  • Spanish International Discussions's Topics
  • Portuguese International Discussions's Topics
  • French International Discussions's Topics
  • Italian International Discussions's Topics
  • German International Discussions's Topics
  • WHMCS Brasil's Topics
  • WHMCS Brasil's Tópicos
  • ModulesGarden Club's Topics
  • Hungarian International Discussions's Segítség
  • ThemeMetro Club's Topics
  • WHMCS Services Club's Topics
  • SwiftModders Club's Topics
  • WHMCS Global Services Club's Topics
  • Zomex Club's Topics

WHMCS Version

  • V7.9.x Hotfixes
  • V7.8.x Hotfixes
  • V7.7.x Hotfixes

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Found 40 results

  1. Following a question from @Mauwiks... natively in WHMCS, there is no way to do this - but with the help of the attached hook, it is possible - just upload the hook to /includes/hooks the hook currently includes EIGHT different parameter options - I can think of at least 4 more options that I could add, and may do so at a later date, but I think 8 is plenty to be going on with. 🙂 note: the addon's ID value can be found when in the URL when you edit that product addon in the admin area - configaddons.php?action=manage&id=1 Linking to one specific product addon cart.php?gid=addons&id=1 Linking to Market Connect product addons by brand cart.php?gid=addons&id=codeguard cart.php?gid=addons&id=sitelock cart.php?gid=addons&id=spamexperts cart.php?gid=addons&id=ssl cart.php?gid=addons&id=weebly these addons are found by the hook searching whether specific terms are found at the START of the product addon descriptions, e.g Codeguard etc Linking to multiple product addons cart.php?gid=addons&multi[]=1&multi[]=32&multi[]=54 Linking to a predefined group of product addons cart.php?gid=addons&id=group1 $group1 is a predefined array of product addon IDs that you can edit in the hook.. $group1 = array(12,28,20); you could, in theory, have multiple groups (arrays of addon IDs) predefined in the hook, but it's currently only coded for 1 group - but it would be simple enough to change. if you pass a numeric addon ID value that doesn't exist for the particular client, then you'll get the no addons available error message... ... I did toy with the idea of showing all addons under those circumstances, but I decided against it for now - not least because it keeps the coding simplified! 😉 if you pass an undefined non-numeric id, e.g cart.php?gid=addons&id=brian, then there is nothing for the hook to remove and it will show all addons as per normal. you can only use one parameter option in a URL - e.g., you can't use cart.php?gid=addons&id=43&multi[]=32 addons_mauwiks.php
  2. Starting from the code provided by @brian! in this post: I realized a pop-up system which shows every time user log-in, but once a day (that's to say: if the user login 5 or more times in a day, the pop-up shows just one time, in order not to annoy him) The pop-up shows to the user his previous log-in time, and one "trick of the day" (randomly chosen one) (IMHO, "trick of the day" is a great way to spread knowledge and marketing news without annoying the user) The code, in form of a hook (note: line #35 is for testing purposes only: remove or comment it): <?php //Show modal popup to clients, with a welcome message and a random trick of the day //original code by brian! , modified by Remitur function client_custom_headoutput_hook($vars) { $head_return = ''; $head_return = '<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js"></script> <script> $(document).ready(function() { $(\'#myModal\').appendTo("body"); function show_modal(){ $(\'#myModal\').modal(); } window.setTimeout(show_modal, 100); $(".dismiss").click(function() {}); }); </script>'; return $head_return; } add_hook("ClientAreaHeadOutput",1,"client_custom_headoutput_hook"); use Carbon\Carbon; function client_custom_headeroutput_hook($vars) { $client = Menu::context('client'); $lastlogin = Carbon::parse($client->lastLoginDate); $enddate = Carbon::parse($client->lastLoginDate)->addDays(1); // next line is just for testing purposes: remove it! $enddate = Carbon::today(); $today = Carbon::today(); $templatefile = $vars['templatefile']; if (empty($client->id)) { return; } if ($today >= $enddate and $templatefile == "clientareahome") { $header_return = ''; $header_return = '<div class="container"> <div class="modal fade" id="myModal" role="dialog"> <div class="modal-dialog modal-md"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title"><i class="fa fa-thumbs-up fa-lg"></i> '.Lang::trans('hello').', '.$client->firstname.'</h4> <p>Your last login has been '.$lastlogin.'</p> </div> <div class="modal-body"> <p>Trick of the day:</p> <p>'.Lang::trans ('tricks.'.rand(1,13)).'</p> </div> <div class="modal-footer"> <button type="button" class="btn btn-primary dismiss" data-dismiss="modal">'.Lang::trans('orderForm.close').'</button> </div> </div> </div> </div> </div>'; return $header_return; } } add_hook("ClientAreaHeaderOutput",1,"client_custom_headeroutput_hook"); The tricks are provided as an array of language variables; here there're 13, I guess that 30 is the minimum reasonable number; more is better. In the tricks you can provide also internal and external links (just one here for example): #====================== tricks for popup ============================================ $_LANG['tricks']['1'] = "On DomainRegister you can register your own .com.br domain even if you have not a headquarter in Brazil"; $_LANG['tricks']['2'] = "Interface on DomainRegister is available in three different languages (English, Italian and Slovenian): select your preferred one using the flags in the upper right corner "; $_LANG['tricks']['3'] = "On DomainRegister you can renew any domain up to 10 years in advance (even those for which a multi-year renewal is not envisaged)"; $_LANG['tricks']['4'] = "If you manage a large number of domains, on DomainRegister you can create one or more DNS templates, to quickly implement complex DNS configurations for each single domain "; $_LANG['tricks']['5'] = "Using wildcard SSL certificates, with a single SSL certificate you can secure both your main domain and an unlimited number of subdomains on any number of different servers"; $_LANG['tricks']['6'] = "<a href=\"https://domainregister.international/dns-service.php\" target=\"_blank\">DomainRegister's DNS service</a> (which is free for any domain registered through us) got 100% uptime... since 2011!"; $_LANG['tricks']['7'] = "If you change the data of the registrant of a .com domain, you cannot transfer the domain for 60 days (sixty days lock)"; $_LANG['tricks']['8'] = "With DomainRegister's Linux Pro hosting plan, you get your own, dedicate european IP for your site"; $_LANG['tricks']['9'] = "DomainRegister's StarterMail starts with 5 email addresses and 5 GB archive space, and may be expanded up to 25 email addresses and 25 GB archive space; larger solutions are available upon request"; $_LANG['tricks']['10'] = "Keep your domains and services safe by protecting them with 2FA authentication: on DomainRegister it's free!"; $_LANG['tricks']['11'] = "trick 11"; $_LANG['tricks']['12'] = "trick 12"; $_LANG['tricks']['13'] = "trick 13"; Any idea to improve this hook is welcome!
  3. Hi! Does anybody know how I can change this: To this: Either via a hook or in what template do I need to look for this? (I'm also using the Lagom theme)
  4. So I'm working with the licensing addon, and attempting to figure out the hook part.. add_hook('LicensingAddonVerify', 1, function($vars) { return [ 'Hash' => 'Hash Here', ]; } ); The hash actually shows in the license how it should, but I'm trying to do it since I make several softwares, and not only one, so what I'm trying to do is something like if ($productid == "prodID number") { add_hook('LicensingAddonVerify', 1, function($vars) { return [ 'Hash' => 'Hash Here', ]; } ); } else -- run get different product It doesn't retrieve the product id at all.. What am I missing here? The hash is basically there to tell the system if a new version has been released. Thanks
  5. In the latest release, you may have noticed that the Request Cancellation link in the left sidebar has been removed for free and one time products and services. This change was made in response to a bug report relating to one time products not being automatically cancelled. There was some concern that allowing cancellation requests for free and one time items, which have no next due date, and therefore terminate immediately on the following cron run could lead to irrevocable data loss. It is important to note that this is only a visual change that removes the link to submit a cancellation request. Submitting a cancellation request for a free service is still possible. If you wish to restore the option to cancel free products, you can do so using a hook. I've prepared some sample code that uses the ClientAreaPrimarySidebar hook point to achieve this. Here is the code below: <?php /** * This hook restores the Request Cancellation sidebar option on free services * * @author WHMCS Josh * @see https://developers.whmcs.com/hooks-reference/client-area-interface/#clientareaprimarysidebar * @see https://developers.whmcs.com/advanced/db-interaction/ */ use WHMCS\Database\Capsule; use WHMCS\View\Menu\Item; add_hook('ClientAreaPrimarySidebar', 1, function($primarySidebar) { // Get the handle for the Service Details Overview sidebar $serviceDetailsOverview = $primarySidebar->getChild('Service Details Overview'); // Make sure the handle is not null if (!is_null($serviceDetailsOverview)) { // Make sure the ID is available if (!empty($_REQUEST['id'])) { $serviceId = (int) $_REQUEST['id']; // Check if this is a free service $billingCycle = Capsule::table('tblhosting') ->where('id', $serviceId) ->value('billingcycle'); if ($billingCycle === 'Free Account') { // Add the cancellation request menu item for the service to the sidebar $serviceDetailsOverview->addChild( 'freeServiceCancellationRequest', [ 'name' => 'CancellationRequest', 'label' => 'Request Cancellation', 'uri' => '/clientarea.php?action=cancel&id=' . $serviceId, 'order' => 90, ] ); } } } }); To install this, you can simply add the code to a file in your /includes/hooks directory such as /includes/hooks/free_product_cancellation_request.php. For convenience, I've attached the completed hook file to this post here: free_product_cancellation_requests.php Below is also a screenshot of how this looked on my test installation of WHMCS 7.7.0. Please note that this is being provided only as an example and is not guaranteed to work with future versions of WHMCS. Feel free to modify it to suit your needs and I hope it helps!
  6. Cubeboy

    Client area panels

    I need to get rid of the date when I add files on the admin side. when I upload a file the a clients account in the admin section, it displays in the client area and it time stamps it. how can I remove the time stamp? OR remove the whole hook and add it back with my own var? <?php use WHMCS\View\Menu\Item; add_hook('ClientAreaHomepagePanels', 1, function (Item $homePagePanels) { $homePagePanels->removeChild('your files:dateadded'); });
  7. I found an older post regarding this but I wanted to post a working hook that adds recaptcha to the checkout page. I think this a great thing especially if you're being bombarded with fake accounts and orders. /includes/hooks/checkout-recaptcha.php: <?php if (!defined("WHMCS")) die("This file cannot be accessed directly"); function limitOrders($vars) { $url = 'https://www.google.com/recaptcha/api/siteverify'; $privatekey = "YOUR_RECAPTCHA_SECRET_KEY_HERE"; $response = file_get_contents($url . "?secret=" . $privatekey . "&response=" . $_POST['g-recaptcha-response'] . "&remoteip=" . $_SERVER['REMOTE_ADDR']); $data = json_decode($response); if (isset($data->success) AND $data->success == true) { // everything is ok! } else { $pm = $vars['paymentmethod']; if ($pm == "paypalpaymentspro") { global $errormessage; $errormessage.= "<li> Please, confirm that you are not a robot! <br/></li>"; } //if CC } } //function add_hook("ShoppingCartValidateCheckout", 1, "limitOrders"); Change YOUR_RECAPTCHA_SECRET_KEY_HERE to your the recaptcha private/secret key Google gives you. I'm using for my credit card checkout which is "paypalpaymentspro" but you can use it for any payment method. I think you really only need if you accept credits though. To get your payment method view source on the checkout page and search for "paymentmethod" your payment method will be near this. In your checkout.tpl file you also need to add somewhere under the "Complete Payment" button: <div class="g-recaptcha" data-sitekey="YOUR_RECAPTCHA_PUBLIC_KEY_HERE"></div> Replace YOUR_RECAPTCHA_PUBLIC_KEY_HERE with your public recaptcha key provided by Google. This is tested working on WHMCS v7.5.1.
  8. 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!
  9. Hi All, Has anyone had any experience with a hook updating an invoice? I want to use InvoicePaidPreEmail to append a credit card fee to the invoice. I understand WHMCS is not willing to budge on per Gateway charges, but I can disclose to my customers that there is a credit card fee of x% and then send the right payment value to the bank, once it returns as approved I can then append it to the invoice and prior to the email being sent it will now include the charge on the invoice. Any help with this is appreciated.
  10. I've created a provisioning module for v7.3.0 and I'm using the following to remove the Change Password button from the Module Command area in admin but it isn't working: add_hook('ClientAreaPrimarySidebar', 1, function(MenuItem $primarySidebar) { if(null !== $primarySidebar->getChild('Service Details Actions')) { $primarySidebar->getChild('Service Details Actions') ->removeChild('Change Password'); } }); Why isn't this working? It looks right to me.
  11. Hello, I have put the hook with the code below in the directory /includes/hooks/: ------------------------------------------------------------------ <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { $urlidr = $vars['clientsdetails']['customfields15']; if (!is_null($primaryNavbar->getChild('Services'))&&!is_null($urlidr)) { $primaryNavbar->getChild('Services') ->addChild('Emergency Contacts', array( 'label' => Lang::trans('buyResellerWebsite'), 'uri' => $systemurl.'cart.php?a=add&pid='.$urlidr, 'order' => '100', )); } }); ------------------------------------------------------------------ The issue is that the variable $urlidr = $vars['clientsdetails']['customfields15'] remains empty, even though listed among those in the page with {debug} in the file clientareahome.tpl. Anyone can help me, please? Thanks.
  12. CrunchyToast

    A couple dev questions

    Hey everyone, Working on a few different modules and had a couple questions. Is there an action hook that allows you to run a cron job every time the WHMCS is called? For example, my WHMCS cron file runs every 5 minutes. Is there a hook or a way I could have a custom hook or script run every time the actual cron runs? All the hooks I see currently only run once a day. Is there a way to add another tab to the client detail page in the admin panel via hook or another method without having to customize the template? Thank you ahead of time.
  13. Hello, We need a customization for ResellerClub (by hooks). We need the module to work exactly as it does the official WHMCS module but with the following customizations: If the country used in the customer's personal data is Cuba. Then the data to be used at the time of registering / transferring the domain is the company data used for the administrative and billing contact (those selected in the domain tab of the general configuration of WHMCS) or other saved in the hooks file. In other words, if the client is from Cuba, then the domains for this client are registered in favor of our company and not in favor of the client. If the client is from Cuba, then he does not have the possibility to modify the WHOIS data of the domain from his client area. For customers from other countries the module should function exactly like the official module. According to WHMCS this can be done by Hooks. Bellow the WHMCS suggestion: We are waiting for some developer who wants to help us in this matter. Greetings
  14. I can seem to find where in the hooks files you would add another link to show up in the account section of the top menu. https://webhost.pro/index.php It looks like it's called: TMSecondaryNavbar.php But when I add a new hook there nothing adds to the menu. Thanks, Charley
  15. The silly documentaion doesn't talk about this and many other questions, which have to be asked here, on the forums and are bothering other members, just because of the poor documentation. It has been asked xx times here like below, but in the documentation you won't find the answer: https://forum.whmcs.com/showthread.php?105202-v6-02-Menu-How-to-add-Link-Target-Attribute&p=433370#post433370
  16. lunaticnoise

    Strange hooks behaviour

    Hello, I have a file /includes/hooks/hooks.php with the following code: <?php add_hook('ClientAreaPage', 1, function($vars) { var_dump("ClientAreaPage"); }); add_hook('AdminAreaPage', 1, function($vars) { var_dump("AdminAreaPage"); }); add_hook('PreRegistrarGetDNS', 1, function($vars) { var_dump("PreRegistrarGetDNS"); }); add_hook('AfterRegistrarGetDNS', 1, function($vars) { var_dump("AfterRegistrarGetDNS"); }); add_hook('PreRegistrarSaveNameservers', 1, function($vars) { var_dump("PreRegistrarSaveNameservers"); }); add_hook('AfterRegistrarSaveNameservers', 1, function($vars) { var_dump("AfterRegistrarSaveNameservers"); }); add_hook('AfterRegistrarGetContactDetails', 1, function($vars) { var_dump("AfterRegistrarGetContactDetails"); }); add_hook('PreRegistrarGetContactDetails', 1, function($vars) { var_dump("PreRegistrarGetContactDetails"); }); I am trying to execute some of the above hooks, but only ClientAreaPage and AdminAreaPage are called when I visit any page of clientside or adminside. I know that PreRegistrarGetDNS, AfterRegistrarGetDNS, PreRegistrarSaveNameservers, AfterRegistrarSaveNameservers, AfterRegistrarGetContactDetails and PreRegistrarGetContactDetails are only called in few actions, for example when the domain register is getting the nameservers, contact details or saving dns records so I go to any admin domain page to force these hooks but sadly they are never called. I also have few breakpoint in the code but the debuger only stops at ClientAreaPage and AdminAreaPage hooks. Is anyone having this issue? My WHMCS version is 7.1.1
  17. Hi, I am trying to create a custom sidebar, to appear only on the domains list page of the client area. I have created a custom hook file in /includes/hooks/. Firstly, I'm wrapping the 'ClientAreaSecondarySidebar' hook in a conditional statement, so it's only displayed on the Client Area Domains page ($templatefile = 'clientareadomains'). Is this the correct way to get the current page / template file being viewed? if (App::getCurrentFilename() == 'clientarea' && $_GET['action'] == 'domains') { ... } Is there a better way to do this? I tried just using $templatefile, but it's not available. Next, I am creating a new secondary sidebar. I have created some client custom fields in WHMCS Admin and I can see them in the Smarty template debug, they are included in the $clientsdetails array as 'customfields2' and 'customfields3' -- how do I access these in my hook? This is what I've tried, but it doesn't work. use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaSecondarySidebar', 1, function (MenuItem $secondarySidebar) { $secondarySidebar->addChild('custom-fields', array( 'label' => 'Custom Fields' ))->moveToBack(); $customFieldsSidebar = $secondarySidebar->getChild('custom-fields'); $customFieldsSidebar->addChild('field1', array( 'label' => $clientsdetails['customfields1'] )); }); Is is possible to get the $clientsdetails array and use it in my hook like this? Any help appreciated. Thank you.
  18. bigideaguy

    WHMCS Slack

    WHMCS Slack allows you to post automatic updates to Slack when events happen in your WHMCS installation you can have an unlimited number of events and an unlimited number of channels. You can even post the same event to multiple channels but with a different message if you would like to. The addon uses WHMCS hooks to post to slack when things happen. The following hooks are available in version 1.0: AddInvoiceLateFee AddInvoicePayment AddTransaction AdminAreaViewQuotePage InvoiceCancelled InvoiceChangeGateway InvoiceCreated InvoicePaid InvoicePaymentReminder InvoiceRefunded InvoiceSplit InvoiceUnpaid LogTransaction ManualRefund QuoteCreated QuoteStatusChange acceptQuote AcceptOrder AddonFraud AfterShoppingCartCheckout CancelOrder DeleteOrder FraudOrder PendingOrder RunFraudCheck ShoppingCartValidateDomain AdminServiceEdit CancellationRequest ServiceDelete ServiceRecurringCompleted AfterModuleChangePackage AfterModuleChangePassword TicketAdminReply TicketClose TicketOpen TicketStatusChange TicketUserReply When editing a hook you can add a channel and the message format you want to post to that channel. Purchase the addon for only $9.99 via our website at http://anveto.com/members/cart.php?a=add&pid=37 Purchase the addon without the encoding in order to make your own modifications for $49.99 at http://anveto.com/members/cart.php?a=add&pid=38
  19. Hi everyone, I'm working on a module that needs to execute three separate tasks after the daily cron job. They need to be executed in a specific order. However, I'm not sure what to watch out for when programming the hook priorities and haven't found any useful documentation on the matter. My question is simple: Are functions with a lower hook priority executed before or after those of a higher priority? And, are duplicate priorities possible or will this result in an exception? Thanks!
  20. Hello, I want to display a user's recent support tickets in some client area pages. I have created a hook following the instructions here and changes the variables. The hook works fine and it displays the results I need. However, it displays the recent tickets of all users. here is my code <?php function hook_displaysupporttickets($vars){ $output = ""; $query = "SELECT * FROM tbltickets ORDER BY date DESC LIMIT 0,6"; $result = mysql_query($query); while ($data = mysql_fetch_array($result)) { $tid = $data["tid"]; $date = $data["date"]; $replyid = $data["replyid"]; $title = $data["title"]; $department = $data["department"]; $date = fromMySQLDate($date); $output .= '<p class="mytitleannoun"><i class="fa fa-file-text-o" aria-hidden="true" style="margin-right:15px;"></i><a style="margin-right:15px;" href="/viewticket.php?tid='.$tid.'">'.$title.'</a><span>'.$department.'</span><span>'.$tid.'</span><font color="#b3b3b3">'.$date.'</font></p>'; } return array("displaysupporttickets" => $output); } add_hook("ClientAreaPage", 1, "hook_displaysupporttickets"); I need to change the code so that it displays only the tickets of the logged in user (each user will see only his own tickets). Any ideas? Thank you.
  21. How can I show the clients first and last name in a support ticket hook. I got everything else working such as userid, message, and subject. But I can't get the first and last names to show. I tried $firstname and $lastname as a varible but it doesn't show.
  22. I am developing an addon module, and it also uses a hooks.php file. I have two hooks: AdminAreaFooterOutput and AdminAreaHeadOutput. My module also includes a lang/english.php file, and I have that working for the main part of my module, now i need to get it working for the hooks file. I have searched the forums and have found many posts relating to the use of Lang::trans. However, in pretty much all cases it says the language string needs to be added to the Language Overrides files. Since this is a module, I'd like it to work without needing any modifications to the main language overrides files. I would rather use the language files distributed with my module for this purpose. So how can I use the text strings from my module/lang/ folder in my hooks.php file?
  23. Thanks in advance for your time, I appreciate your attention to detail. May you please post estimate plus turnaround? There is no set budget, or specific deadline. I desire, a specific product / service on-purchase, to create new support ticket. • Visitor lands on website and wants to buy "Consultation Service" • Visitor does three things - add product / service to cart - inputs customer data and checks-out - submits successful payment VIA paypal • Visitor receives new email with support ticket link From what I read, @sentq made quality reply, saying developer will need to understand: http://docs.whmcs.com/Hooks http://docs.whmcs.com/Hooks:ShoppingCartCheckoutCompletePage http://docs.whmcs.com/Configuring_Products/Services Once addon module is complete, assuming this is best way to create results, I would like to publish on repo to share with community. If you think that is not best, no problem.
  24. I want to set the ticket status to "Open" whenever a reply is made by an admin, I am doing so because WHMCS do not log the change in ticket status a response is made to the ticket, my idea is to force my staff to change the ticket status through the dropdown. Below is my code for it but I am getting error 500 with this code. <?php if (!defined("WHMCS")) die("This file cannot be accessed directly"); function set_ticket_open($vars) { $tid = $vars['ticketid']; UPDATE `tbltickets` SET `status`="Open" WHERE `id`="$tid"; } add_hook("TicketAdminReply",1,"set_ticket_open"); ?> Can anyone help me with fixing this code or give me any other code that can log the status change in database according to the status selected during "add response".
  25. earthgirlllc

    Question on add_hook()

    I'm trying to understand hooks -- would someone please tell me what the number 1 represents here: add_hook("ClientAdd",1,"create_forum_account"); I'm sure it's simple, but I'm not finding it in the documentation. Thanks

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated