Jump to content

Search the Community

Showing results for tags 'hook'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


WHMCS.Community

  • The latest WHMCS Release
    • V7.9 Beta Discussion
  • 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 Beta Program
  • 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

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 28 results

  1. dear community member.. hope all doing very well. i am trying to make a module for my VoIP project . one of my friend helping me out in this module. but i dont know what he done something is he can't figure out how to fix. basically its for VoIP project. so we will sell voip service with local city number. so when the ordering time we will select the city and then based on the city name the available numbers will be display.. so for the list of city the api link is https://mydomainname.com/api/city_list.php?&token=123456 this api link display all the city name from remote database so thats i want it to show in one custom field and for the second custom field based on the city name i have another api link which is https://mydomainname.com/api/did_free.php?city=Dublin&token=123456 which shows result this way its only shows the number is dublin city from the remote database. my friend make the module for me. but the way i want its show very right in the customer order form . i mean if customer directly buy from the client area its shows perfect according to city name so when i select the city then i see available numbers based on the city which the way i wanted to see from the client area. so from the client area its works properly no problem. problem with from the admin area when i wanted to setup a product to client from admin in the admin panel i see like this which means its doesn't matter which city i select. but i see all numbers from my remote database. like 35391 is Galway numbers 35314 is Dublin Numbers and 35321 is Cork numbers. they are all showing together. which is very frustrating . here is my hook file code. can some please please tell me where he did wrong? HOOK FILE CODE ======================================== <?php use PDO; use Exception; use PDOException; use WHMCS\Database\Capsule; $host = 'https://mydomainname.com/api/'; $token = '123456'; $ch = curl_init(); $fields = array( 'token' => $token ); curl_setopt($ch, CURLOPT_URL, $host.'city_list.php?'.http_build_query($fields)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $city = curl_exec($ch); curl_close($ch); $packageNames = json_decode($city, true); $citylist = array(); $numberslist = array(); foreach ($packageNames['result'] as $packageName) { $citylist[$packageName['city']] = ucfirst($packageName['city']); $ch = curl_init(); $fields = array( 'city' => $packageName['city'], 'token' => $token ); curl_setopt($ch, CURLOPT_URL, $host.'did_free.php?'.http_build_query($fields)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $numbers = curl_exec($ch); $numbers = json_decode($numbers); $numberslist = array_merge($numbers->result,$numberslist); curl_close($ch); } $citylist = implode($citylist,','); $numberslist = implode($numberslist,','); //echo json_encode(array('cities'=>explode(",",$citylist),'numbers'=>explode(",",$numberslist))); $pdo = Capsule::connection()->getPdo(); try { $result = $pdo->query( "update tblcustomfields set fieldoptions = '".$citylist."' where fieldname = 'City'" ); } catch (\Exception $e) { echo "Uh oh! {$e->getMessage()}"; return $e->getMessage(); } try { $result = $pdo->query( "update tblcustomfields set fieldoptions = '".$numberslist."' where fieldname = 'Available Phone Numbers'" ); } catch (\Exception $e) { echo "Uh oh! {$e->getMessage()}"; return $e->getMessage(); } add_hook('OverrideModuleUsernameGeneration', 1, function($vars) { return $vars['customfields']['Available Phone Numbers']; }); ============================================================= please someone help me to correct the code. please
  2. Hello, I am trying to create a hook for adding a new element in sidebar. I have created the hook. add_hook('ClientAreaPrimarySidebar', 1, function($primarySidebar) { /* @var \WHMCS\View\Menu\Item $primarySidebar */ $newMenu = $primarySidebar->addChild( 'accountmanager', array( 'name' => 'Home', 'label' => Lang::trans('account_manager'), 'order' => 1, 'icon' => 'fas fa-life-ring', ) ); $newMenu->addChild( 'accountmanager', array( 'label' => Lang::trans('account_manager_label'), ) ); }); I am trying somehow to get the userid, and assign it to a variable. And is it possible to be used in translations? I tried with this one here but it's not working: $variable = $template->getVariable('variablename')->value; $template->assign('variablename ', 'variable');
  3. Any idea what hook I can add to remove these side bar ads? I'm still selling these products? I just don't want them on the side bar right now. I might add them back later. I checked my current hooks and non seem to line up with these sidebar ads. I assume I need to add a new hook to remove these. Thanks for any help.
  4. hello community hope we all doing well. i just need bit help if you can help me with that. i think i need a hock to remove some menu item from the homepage i need to remove the Store Menu item and the Announcement. can someone guide me with the hook so i can remove them 🙂 thanks in advance everyone 🙂
  5. sokalsondha

    Set next invoice date

    Hello community... I came back again. Can someone help me with my system. What happened is.. We sell yearly service. Let's say client bought service 01/04/2018 And his next due date is 31/03/2019. Now system generate invoice on 15/03/209 But he didn't paid. He decide to pay on may.. I knw the service will be suspended. But it's not a problem. Now if he pay on may .. I see his next due date will be 31/03/2020 not 01/05/2020 So he is loosing a month when he didn't used the service in April. Can we have a hook to update the next invoice date the customer paid+365 days? Please help me
  6. Favicon manager module lets you add a favicon image to your WHMCS website. Favicon is a small icon image or logo displayed in the address bar of a web browser. By using this Module, you can easily upload and change favicon icon on your WHMCS. You can create favicon icon for each page or only use one favicon icon The favicon manager module is free. You can download the favicon manager module from the product page. The favicon manager module is encoded with ionCube if you want the source code you can buy from the product page Favicon Manager Module Features Very simple and easy to use. No complex menus or setting. Just upload an image and change your website's default favicon logo. Enable or disable the favicon on the website. Create favicon icon for each page on the website. Compatible with WHMCS version 6.x.x View the product Page View all our works and Products
  7. Hello I use OrderDomainPricingOverride hook to change some domain price manually, I need two registrars to use this hook, but when I add hook file to the second registrar's folder I get blank page and the whole site shuts down. I don't use any registrar function in the file, I just check domain's sld and tld and generate price, how can I manage to use the hook for both registrars ? this is my whole hook file: <?php /** * WHMCS SDK Sample Registrar Module Hooks File * * Hooks allow you to tie into events that occur within the WHMCS application. * * This allows you to execute your own code in addition to, or sometimes even * instead of that which WHMCS executes by default. * * WHMCS recommends as good practice that all named hook functions are prefixed * with the keyword "hook", followed by your module name, followed by the action * of the hook function. This helps prevent naming conflicts with other addons * and modules. * * For every hook function you create, you must also register it with WHMCS. * There are two ways of registering hooks, both are demonstrated below. * * @see https://developers.whmcs.com/hooks/ * * @copyright Copyright (c) WHMCS Limited 2016 * @license https://www.whmcs.com/license/ WHMCS Eula */ // Require any libraries needed for the module to function. // require_once __DIR__ . '/path/to/library/loader.php'; // // Also, perform any initialization required by the service's library. /** * Register a hook with WHMCS. * * add_hook(string $hookPointName, int $priority, string|array|Closure $function) */ add_hook('AdminHomeWidgets', 1, function() { return new SampleRegistrarModuleWidget(); }); add_hook('OrderDomainPricingOverride', 1, function($vars) { // Perform operations to determine price // logActivity('OrderDomainPricingOverride 900', 0); $domain = explode('.', $vars['domain']); $sld = $domain[0]; $tld = '.' . $domain[1]; $domain_name = explode('.', $vars['domain']); if(count($domain_name)==2 && strlen($domain_name[0])==2 && $domain_name[1]=='ge'){ return 900.00; } }); /** * Sample Registrar Module Admin Dashboard Widget. * * @see https://developers.whmcs.com/addon-modules/admin-dashboard-widgets/ */ class SampleRegistrarModuleWidget extends \WHMCS\Module\AbstractWidget { protected $title = 'Sample Registrar Module'; protected $description = ''; protected $weight = 150; protected $columns = 1; protected $cache = false; protected $cacheExpiry = 120; protected $requiredPermission = ''; public function getData() { return array(); } public function generateOutput($data) { return <<<EOF <div class="widget-content-padded"> Your widget output goes here... </div> EOF; } }
  8. Hello All, I am trying to following part of code within the viewinvoice page but the paymentbutton is not updated. Is the smarty->assign option still supported? <?php function custom($vars) { global $smarty; if ($vars['filename'] == 'viewinvoice' && $vars['status'] == 'Unpaid') { $smarty->assign('paymentbutton', "BG"); } } add_hook('ClientAreaPage', 1, 'custom'); ?> The hook seems to run but the paymentbutton is not updated. Does anyone have the same issue? How can we update the paymentbutton?
  9. Hello, I have built a hook to show a new navbar, but I want it to hide to not logged in members. Is this possible? Thank you My hook im using: <?php use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { $primaryNavbar->addChild('Tools') ->setOrder(50); $primaryNavbar->getChild('Tools') ->addChild('Html Tester') ->setUri('/html.php') ->setOrder(1); $primaryNavbar->getChild('Tools') ->addChild('Privacy Policy Generator') ->setUri('/privacypolicygenerator.php') ->setOrder(2); $primaryNavbar->getChild('Tools') ->addChild('cPanel Backup Generator') ->setUri('/backup.php') ->setOrder(3); });
  10. We are trying to include a productID into a tracking link so we can include the product which was purchased. A hook is required for it and we require someone who can write a simple one. Example of the complete.tpl link: <img src="https://trackingurl.com/ep?ord={$ordernumber}&orderid={$orderid}&product={$THISISMISSING}&qlist={$smarty.session.orderdetails.Products|@count}&amtlist={$amount*100}&cur=USD&img=1"> Thank you!
  11. Hi, I am trying to add a link tot he affiliate login page under the account menu section. Just like the log in hook for the main section. I would like it to be under the: login register lost password (Affiliate Login) Thanks for any help. I've checked the TMSecondaryNavbar.php file but can't see what to add. I tried to add this: $primaryNavbar->getChild('Company') ->addChild('Affiliate Login', array( 'uri' => 'affiliates.php', 'order' => '20', )); But it crashed the whole site. Thank you, Charles
  12. battles

    A-Record by product.

    I'm in need of setting an A-record to a specific IP when certain set of products is ordered. Enom and using their API. Would I create a hook?
  13. Hey guys! I was unable to find a good way of updating bitcoin currency rates so I decided to create my own module to do this for me and that resultet in Anveto Currency Rates. This addon will update additional currency rates when the daily cron runs or when Anveto cron runs (see downloads here for anveto cron https://anveto.com/members/downloads/2/WHMCS) in order to update currencies multiple times daily. Currently it uses the bitpay (https://bitpay.com/api/rates) to get currency rates but you could set this to any source as long as it follows the same json format. The module costs $10 and can be purchased here https://anveto.com/members/cart.php?a=add&pid=21 It is currently pending community app store review. The source code is not encrypted as I want users to be able to modify this however they would like as long as they purchase the module. I hope some of you find it useful!
  14. 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.
  15. Good morning, We created a WHMCS provisioning module for our control panel. Because in our control panel, the usernames match the domain names, we added a hook which overrides the username that is automatically generated by WHMCS when an order is being placed. The hook look as follow: /** * Replace generated username by domain name */ add_hook('OverrideModuleUsernameGeneration', 1, function ($vars) { if($vars['moduletype'] != 'imscp') { return null; } return $vars['domain']; }); This works well for products that are setup automatically (the hook is run as expected and the username is set with the domain name as expected). However, when the order is placed and accepted manually, or when the product setup is not automatic, the hook is not triggered and thus, the username is not overriden. We already reported the issue to WHMCS team (#AMI-418461 no answered yet) but it would be great if someone here could help us to find a temporary workaround. The hook should be triggered in every contexts (when our provisioning module is involved). To resume, each time the username is being generated, that hook should be called. Thank you for your help. Involved WHMCS version: 6.3.1
  16. What I am trying to do is to add a hook where variables are send to an external page for processing via get or post. The page is on other domain and involves creating directories so te hook itself won't be able to do that. hook = get variables (userid, domain) and send to an external page. (Same server, other domain. The database can be updated from either side so it's no problem) Do anybody have some ideas please?
  17. Hello, I'm working on making it possible to show a Twitter feed based on the client. That way we can show different feeds for resellers and end-users. When someone isn't logged in I would probably show the end-user Twitter account. Changing the Twitter account for the URLs pointing to Twitter is easy. However with an AJAX (?) call it doesn't work. From WHMCS support I did hear I should be able to create some output on it when using the ClientAreaPage hookpoint. However this doesn't seem to work as the code below doesn't return any content (and that is what I would expect). <?php function whmcs_hook_test($vars){ var_dump($vars); } add_hook('ClientAreaPage',10,'whmcs_hook_test'); Any pointers as where to look? Or should I just create a new PHP file for it that gets the required information from Twitter and call that file using the Javascript?
  18. With the Login with PayPal Module, your clients can authenticate into your WHMCS using PayPal. It’s the same procedure we already know for Facebook, or maybe Twitter and GitHub. The Login with PayPal module is a commerce identity solution that enables clients to register/login into the client area quickly and securely using their PayPal login credentials. One of the most important reasons to use the module is simplicity. Your clients will not need to remember another set of credentials – the same advantage OAuth via FB, Twitter, etc have. In addition, the login procedure is absolutely secured fewer concerns for you. However, it’s not just an email and a password. Features Login form the client are login page Register form the client register page Register or login form the checkout page Connect to PayPal for existing clients from the client panel Clients register list for admin area to see all connected clients Custom buttons – you can use your own buttons style Debug mode – sandbox or live View the product Page View all our works and Products
  19. I created an action hook (almost) that will force clients to agree to new terms of service (on login) before being able to continue to client area. I created a new column under "tblclients" called "tosversion" (which is type "date" instead of a version number) and that gets updated no problem when the client logs in. The only problem is displaying a page or popup that displays the TOS before this field is updated. the code: <?php $updateddate = "2016-02-16"; function hook_tos_clientlogin($vars) { /// CHANGE YOUR TOS VERSION $updatedtosversion="2016-02-16"; $clientid = $vars['userid']; if (!filter_var($clientid, FILTER_VALIDATE_INT)) { return; } $tbl="tblclients"; $fields = "tosversion"; $where = array("id"=>$clientid); $result = select_query($tbl,$fields,$where); $data = mysql_fetch_array($result); $ctosversion = $data['tosversion']; if ($ctosversion < $updatedtosversion) { //we don't match, do something. // make sure we update at the end of this $update = array("tosversion"=>"$updatedtosversion"); $where2 = array("id"=>"$clientid"); update_query($tbl,$update,$where2); } else { //just a courtesy else } } add_hook("ClientLogin",1,"hook_tos_clientlogin"); ?> What am I missing?
  20. I am looking to delete certain gateways from a hook so that these gateways are not shown on the cart. The following code does the filtering/removal of the relevant gateways in a hook: function hook_HideGateways($vars) { global $CONFIG; if ($vars['filename']=='cart') { // delete all but securetradingadvanced from gateways array foreach ($vars['gateways'] as $gw_name => $gw) { if ($gw_name != 'securetradingadvanced') { unset($vars['gateways'][$gw_name]); // delete gateway } } } } add_hook('ClientAreaPage', 1, 'hook_HideGateways'); How can I then return/override the $gateways Smarty variable as used in the cart templates? Thanks in advance!
  21. I am trying to run ClientChangePassword hook after ClientEdit hook. BUt no matter what priority I set for them, ClientChangePassword always runs before ClientEdit! How to overcome this? Can anyone please help?
  22. We just finished updating the Admin Private Messages module to v2.0.0 to work on WHMCS v6. Note that v2.0.0 only support WHMCS v6 or later if you need the module to work on WHMCS v5 you can still use Admin Private Messages v1.6.0 Changlog Rewrite the code from scratch Support only WHMCS v6 Changed the dialog box Added send messages section Added email template editor Added send message to all staff View the product Page View all our works and Products
  23. Take advantage of our WHMCS Addons with 50% Discount during this Weekend! Offer is available to new and existing customers. The Coupon Code is: 50OFFWE Supports WHMCS v5 & v6. One Time pricing. For Screenshots, More Details and Prices please visit our WHMCS Addons page.
  24. A very important feature is missing from WHMCS, the language fallback. It's impossible to able to translate all custom stings to all languages, so best scenario is to load the default string translation, for example "english". This is the hook code of "languageFallback.php", the code seems OK but does not effect the loaded language. Any suggestion? /* Developer: Stergios Zgouletas Web-site: web-expert.gr License: GNU GPL v2 */ if(!defined("WHMCS")) die("This file cannot be accessed directly"); function languageFallback($vars){ $defaultLanguage='english'; //Fallback Language $currentLanguage=strtolower($vars['language']); //Current Active Language global $_LANG; $current=$_LANG; if($defaultLanguage!=$currentLanguage){ //Load default language file $default=array(); if(file_exists(ROOTDIR.'/lang/'.$defaultLanguage.'.php')){ require(ROOTDIR.'/lang/'.$defaultLanguage.'.php'); $default=$_LANG; } //Load default override language file $defaultOverride=array(); if(file_exists(ROOTDIR.'/lang/overrides/'.$defaultLanguage.'.php')){ require(ROOTDIR.'/lang/overrides/'.$defaultLanguage.'.php'); $defaultOverride=$_LANG; } //Load module's language $module=array(); if(isset($_REQUEST['m']) && !empty($_REQUEST['m']) && file_exists(ROOTDIR.'/modules/addons/'.$_REQUEST['m'].'/'.$defaultLanguage.'.php')){ require(ROOTDIR.'/modules/addons/'.$_REQUEST['m'].'/'.$defaultLanguage.'.php'); $module=$_ADDONLANG; } $_LANG=array_merge($default,$defaultOverride,$module,$current); return array('languageFallback'=>1); } return array('languageFallback'=>0); } add_hook("ClientAreaPage",0,"languageFallback");
×

Important Information

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