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


WHMCS.Community

  • The latest WHMCS Release
    • WHMCS 8.2 Release Discussion Board
  • WHMCS Beta Program
    • WHMCS Mobile App Technical Preview Feedback
  • The Latest from the WHMCS Team
    • News, Announcements & Blogs from WHMCS
  • 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
    • Feedback
    • 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
  • WHMCS Global Services Club's Topics
  • Katamaze's Free Scripts
  • Katamaze's Modules
  • Zomex Club's Topics
  • 0100Dev Club's Topics

WHMCS Version

  • V8.2.x Hotfixes
  • V8.1.x Hotfixes
  • V8.0.x Hotfixes
  • V7.10.x Hotfixes
  • V7.9.x Hotfixes

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


About Me

Found 58 results

  1. Hi, does anyone has a Hook which auto enables the DNS of new Domains in WHMCS? Customers always complaining that DNS Management is missing and i have to switch that on, all the Time. And i wont take this as upselling position. So activate DNS Management in Frontend for "0$" is aswell not suitable for me. It just be there and done 🙂 Any Suggestions, or Code Templates?
  2. Hello all. I am hoping you can help me do what I think should be simple for people who have dealt with hooks already. I want to do this: IF a product's ID = x (I imagine this involves getting the product ID from a variable and doing an IF statement in PHP) THEN get the service_domain field (built-in field, not custom field), run a shell script while passing the domain field as a bash variable to be used within the script's execution. Why do I want to do this? This will allow me to begin the process of provisioning maintenance coverage via WP CLI for customers who order a maintenance plan from us. I'll create an additional 2 hooks -- three total so one for each maintenance plan. If I can get the first hook, i can make the others and likely merge them together. I just need a "template" to follow from someone who understands PHP more than on the surface like I do. This ultimately will chain 3 of my servers together. WHMCS server, our cPanel server, and the maintenance server. Any help is appreciated. Would anyone be willing to paste in an effective code sample that I can use?
  3. Hello, I created a hook file for the 'OrderPaid' event and it seems like the $vars variable that is being passed to it always comes up empty. Does anyone know why this is happening?
  4. Hello, I created a hook file for one of my addon modules and it seems like the hook event is always happening. The hook event is 'OrderPaid'. When I look at the module logs there is an entry for this hook event every minute even though no orders have been paid for during this time. I need to know why this is happening. If anyone can help me I would appreciate it.
  5. Hi there, I have returned $vars from EmailPreSend Hooks like this Array ( [messagename] => Other Product/Service Welcome Email [relid] => 805 [mergefields] => Array ( [service_first_payment_amount] => WHMCS\View\Formatter\Price Object ( [price:protected] => 350000 [currency:protected] => Array ( [id] => 1 [code] => IDR [prefix] => Rp [suffix] => IDR [format] => 3 [rate] => 1.00000 ) [defaultFormat:protected] => {PREFIX}{PRICE}{SUFFIX} [defaultCurrencyDescriptor:protected] => Array ( [format] => 1 [prefix] => [suffix] => ) ) How to print "350000" on price protected object from ['mergefields']['service_first_payment_amount'] I try $vars['mergefields']['service_first_payment_amount']->price; But i get message Error: Cannot access protected property WHMCS\View\Formatter\Price::$price
  6. Hi all! I'm writing an Add-on and am trying to hook to UserEdit, but I'm finding that in My Profile (client area) there are 2 'SAVE' buttons: Top for the name, bottom for the email. A simple logging statement at the beginning of the hook declaration in my hooks.php file is showing that the hook is called as expected with the TOP SAVE button, but not on the BOTTOM ??? Can somebody please confirm if this is a bug or a problem with my installation and how to troubleshoot it? I'm on v8.1.0-release.1 Thank you in advance.
  7. Dear All, I want to show the Next Invoice Date under Next Due Date when admin access Page Client Details on Product/Services Tab. But, I've no idea how to show it, I just know to get the Next Invoice Date value related from tblhosting Anyone can help me to show it ? Thank you. <?php use WHMCS\Database\Capsule; add_hook('AdminClientServicesTabFields', 1, function($vars) { $PID = $vars['id']; $nextinvoicedate = Capsule::table('tblhosting')->where('id', $PID)->pluck('nextinvoicedate'); $result = array(); $result['nextinvoicedate'] = $nextinvoicedate; return $result });
  8. Hi all, I wish to perform some registrar API activities in the registrar hooks, but as the hook's vars or params didn't provide credential details, I tried to get direct from DB Capsule and unfortunately noticed the data stored in encrypted format... Any suggestions to over come this? TQ. Best Regards, Nelson
  9. Hello, I am working on a custom hook and I find that just by adding an input field of type Tel, the country code is added by WHMCS. I am basically showing a modal from my hook if a condition is met. Now I am testing the example code on the IntlTelInput plugin website (https://intl-tel-input.com/node_modules/intl-tel-input/examples/gen/default-country-ip.html) $(document).ready(function(){ var input = document.querySelector("#phone"); window.intlTelInput(input, { initialCountry: "auto", geoIpLookup: function(callback) { $.get("https://ipinfo.io", function() {}, "jsonp").always(function(resp) { var countryCode = (resp && resp.country) ? resp.country : "us"; callback(countryCode); }); }, }); }); <input type="tel" id="phone"> But that's returning an error: I basically want to sow the local country code in the form. is there a way to achieve this? bearing in mind that I am not in the tpl file, just echoing a modal from my hook.
  10. Dear All, My Product setting Configuration Prorate Date: 1 Charge Next Month: 32 So, every product that client buy will have Next Due Date value on tblhosting 01/mm/yyyy on each month My Goal: I want to make all Invoices that created by automatic cron (recurring invoice, etc) and publish to client have a duedate value 10/mm/yyyy The Next Due Date from tblhosting do not need to be change, because I need the product period date is 1 until the end of the date of that billed month. Is it possible to do that by create Hooks ? If yes, which Hooks variable that I need to use to achieve it ? If due date value from tblinvoices can be overwrite by hook, does the invoice reminder cron will follow the new due date ?
  11. sometimes the client can have 2 emails. one for your account details and one for the account owner. I need to know if the account owner's email is verified. The var: $client = Menu::context("client"); gets the email that the customer has in the account details, however this is not the email owner of the account. I hope to make myself understood correctly.
  12. Hi Community, I have been trying to figure something out for a while now and am at the end of the road. We have a block of JavaScript which we wish to execute on any page where the user has got a certain product active. If they don't have the certain product, nothing should happen, but if they do, I want the JavaScript to execute. I was thinking that a hook might be the best way to accomplish this, but I am unsure of how to make this work? Any suggestions or ideas would be massively appreciated. Many thanks, Sam
  13. Hello, I am new to this community! I am setting up a hook that allows me to pass new client data to Zapier in order to update our Marketing automation software. This is the code I have been testing now: add_hook('ClientAdd', 1, function ($vars) { $userid = $vars['userid']; $firstname = $vars['firstname']; $lastname = $vars['lastname']; $email = $vars['email']; $phone = $vars['phonenumber']; $city = $vars['city']; $country = $vars['country']; $postcode = $vars['postcode']; $company = $vars['companyname']; $state = $vars['state']; $params = '?userid='.$userid.'&firstname='.$firstname.'&lastname='.$lastname.'&email='.$email.'&phonenumber='.$phone.'&city='.$city.'&country='.$country.'&postcode='.$postcode.'&companyname='.$company.'&state='.$state.'&source=WHMCS'; $url = 'https://hooks.zapier.com/hooks/catch/zzz/rrrr/'.$params; $options = array( 'CURLOPT_POST' => 0 ); $response = curlCall($url,$postfields,$options); logActivity('logged addClient with params: ' . $params . 'following is the result: ' . $request, $userid); }); I also tried to send this via file_get_contents but it does not seem to work, by composing the url together with real world values gotten from the LOG in the admin area the request works on Zapier's end, I suppose that the problem lies within WHMCS and the request. The Zapier request has been altered for privacy reasons. Can anyone point me in the right direction?
  14. Hi, I've been unable to find other posts on the topic, should there be any I am sorry for posting. I am looking for a way to place orders that will be flagged as fraud. This is in order to test some post fraud check hooks. I have tried Maxmind/Fraudlabs with bogus zip codes, hotmail email, high risk countries. Orders just pass trough as OK. If anyone has any suggestions as to triggering fraud check with automatic listing as fraud-order please share. Setting a order to fraud manually is not an option, as certain hooks does not trigger with this behavior. Cheers
  15. Hello, I am creating a module for invoice to display data from database. I want to know how to add that fetch value from module to invoice using hooks.
  16. how to get user request module info into modules hook folder structure: mymedia | | +---- hooks.php +---- mymedia.php +---- index.php created products: product-01: product-02: ------------------- ------------------- | Name: media 01 | | Name: media 02 | | Module: mymedia | | Module: mymedia | | | | | |_________________| |_________________| here, TableName: tblproducts ----------------------------------------------------- | id | name | servertype | ...... | ------------------------------------------------------- | 1 | media 01 | mymedia | ...... | | 2 | media 02 | mymedia | ...... | | .. | ........... | ....... | ...... | ----------------------------------------------------- hooks.php: <?php add_hook("AcceptOrder", 0, "mymedia_acceptOrder"); function mymedia_acceptOrder() { // how to get request product id or name here $mediaIDorName = ?? } ?> NB: how to get user request module info into modules hook.
  17. Hello! I'm using Lang::trans within a php hook for EMailPreSend. I set 'credited' in each language override file: $_LANG['locale'] = "en_GB"; $_LANG['credited'] = "has been credited"; and $_LANG['locale'] = "ro_RO"; $_LANG['credited'] = ": tranzacția a fost creditată"; Then, in the hook: $merge_fields = []; $paymentMethodTitle = "Bank Transfer"; $newSubject = $paymentMethodTitle.' '.Lang::trans('credited'); $merge_fields['custom_subject'] = $newSubject; $vars = array_merge( $vars, $merge_fields ); return $vars; In the Email Template, the subject is {$custom_subject}, which shows $newSubject variable just fine. But I guess Lang::trans doesn't use the client's language. The email template (body) uses the client's language without issue, but ... how in the world do I get Lang::trans in EMailPreSend to use the client's language? I just want the client's language to be used when sending the client an email (call me silly!). Thanks for any clues!
  18. Hi, Just trying to get some insight on adding a shopping cart icon like on this image to the WHMCS main menu. blog.webhost.pro/wp-content/uploads/2015/11/cart.jpg I can add hooks, I just have no idea how to add a hook next to the menu "account" drop down link. I also am not sure how to add an icon with a number to show how many items are in the shopping cart. I am willing pay for help as well. Any insight will help me. Thanks so much for your time. Charles
  19. I am trying to remove the sidebar menu "Actions" from the My Products and Services page. I have created the following hook: ``` <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimarySidebar', 1, function(MenuItem $primarySidebar) { if (!is_null($primarySidebar->getChild('My Services Actions'))) { $primarySidebar->removeChild('My Services Actions'); } }); ``` But it is not removing the sidebar from the page /clientarea.php?action=services What am I doing wrong? Thanks, Steve
  20. 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
  21. Hello everyone, My requirement is that let's say I have one configuration option called "personal computer" which is text box. User will fill 1, 2, 3, etc... When they check out ("Click to Continue" button), I need to check one value from my another site by calling web service. Eg. If they fill 3 and result from another site is less than 3, they cannot check out. My problem is I don't know whether there is a hook that run before user can checkout. I had tried following hooks but still can't find the solution. 1) ShoppingCartValidateProductUpdate, 2) ShoppingCartValidateCheckout 3) ShoppingCartValidateProductUpdate 4) ShoppingCartValidateCheckout 5) PreShoppingCartCheckout 6) PreCalculateCartTotals Most of them are not working, or, I don't know when will they fire. Please help me. Is this possible to achieve? Or is there any work around to achieve this? Thanks in advanced tslin
  22. 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!
  23. 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)
  24. 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!
  25. 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
×
×
  • 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