Jump to content

Search the Community

Showing results for tags 'php'.



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 45 results

  1. this is a snippet of my quote/contract script it seems to know the recurring but not the onetime, it shows the "unit price" but no the "total price I need to have the one time and payments show up in the contract the 2 hooks you need to add in //term is the call // 1 displays the number of months [term: 1] [recur:36] <?php $pdf->Image(ROOTDIR.'/assets/img/rwclogo.png', 63,10,75,'c'); $pdf->MultiCell(170,5,""); $pdf->SetFont('freesans','B',11); $pdf->Cell(175,40,"CONTRACT FOR $subject ONLINE MARKETING SERVICES",25,1,'C'); $total_onetime = 0; $total_recur = array(); foreach ($lineitems AS $item) { $description = $item["description"]; # find term $matches = array(); preg_match('/\[term:(.*?)\]/i', $description, $matches); if (empty($matches)) { $term = ''; } else { $term = strtolower(trim($matches[1])); $description = str_replace($matches[0], '', $description); } # find recur $matches = array(); preg_match('/\[recur:(.*?)\]/i', $description, $matches); if (empty($matches)) { $recur = ''; } else { $recur = strtolower(trim($matches[1])); $description = trim(str_replace($matches[0], '', $description)); } # get unit price and total price $matches = array(); preg_match('/\d+\.\d+/', $item['unitprice'], $matches); $item_unitprice = (float)$matches[0]; $matches = array(); preg_match('/\d+\.\d+/', $item['total'], $matches); $item_total = (float)$matches[0]; # add onetime and recurring totals if ($recur == '') { $total_onetime += $item_total; } else { if (!array_key_exists($recur, $total_recur)) { $total_recur[$recur] = 0; } $total_recur[$recur] += $item_total; } } $pdf->SetFont('freesans','B',9); if ($total_onetime > 0) { } foreach (array('monthly', 'quarterly', 'semi-annually', 'annually', 'biennially') as $recur) { if (isset($total_recur[$recur]) && $total_recur[$recur] > 0) { } unset($total_recur[$recur]); } # any remaining recurs foreach ($total_recur as $recur => $amount) { } #========================================================================== # determine weather to show the ONE TIME payment or not #if ( $total_onetime < 100 ) { #$ot_show = false; #} #else { #$ot_show = true; #} #========================================================================== # determines weather or not to split the initial payment in half #if ( $total_onetime >= 10000 ) { #$bulk = $total_onetime / 2; #$addtl_payment_msg = 'and the second half of $' .$bulk. ', will be due within 60 days. '; #} else { #$bulk = $total_onetime; #$addtl_payment_msg = ''; } #========================================================================== #calculate One time payment using monthly pymts as a varible #========================================================================== #$otpp = ( $total_recur[$recur] * $recur ); #$ots = ( $otpp * .1); #$ots = round( $ots, 2, PHP_ROUND_HALF_UP ); #$otp = $otpp - ($otpp * .1); #$otp = round( $otp, 2, PHP_ROUND_HALF_UP ); #========================================================================== #calculate One time payment and monthly payment to come up with a total #$totalot = ( $total_recur[$recur] * $recur + $bulk ); #$totalot10 = ( $totalot - $ots ); #========================================================================== $pdf->SetDrawColor(255); $pdf->SetFillColor(255); $pdf->SetFont('freesans','B',9); $pdf->Cell(170,5,"Authorization:",0,0,'L'); $pdf->SetFont('freesans','',9); $pdf->MultiCell(170,5,""); $pdf->SetFont('freesans','',9,C); $pdf->MultiCell(170,5," This document defines the TERMS AND CONDITIONS (T&C) of our working relationship. All projects or services (“the work”) that AGENCY (or “we”) RWC ME 04401 may be contracted to produce or provide for CLIENT ($clientsdetails[companyname]) will be subject to and you the undersigned agree to the following: The CLIENT authorizes the AGENCY access CLIENT's current website, webhost, and all digital materials to transfer as needed from the CLIENT for the purposes of completeing the work on the domain $subject. The CLIENT authorizes use of CLIENT's logo and all brand identification in the creation of the website. The CLIENT understands they are entering into a$pdf->Cell $recur month contract with THE AGENCY. The Agency will only begin work after CLIENT’s approval of the project authorization to proceed,(ATP) and the terms and conditions,(T&C) and after receipt of payment of the initial invoice $".$total_onetime. ". Your signature/execution of the ATP and the T&C will constitute an AGREEMENT between us. "); $pdf->MultiCell(170,5,""); $pdf->SetFont('freesans','B',9); $pdf->Cell(170,5,"Description of the work:",0,0,'L'); $pdf->SetFont('freesans','',9); $pdf->MultiCell(170,5,""); $pdf->SetFont('freesans','',9,L); $pdf->MultiCell(170,5,"$notes",0,1,'C'); if ($proposal) { $pdf->MultiCell(170,5,""); $pdf->SetFont('freesans','B',9); $pdf->Cell(170,5,"Installment Plan:",0,0,'L'); $pdf->SetFont('freesans','',9); $pdf->MultiCell(170,5,""); $pdf->SetFont('freesans','',9,L); $pdf->MultiCell(170,5,$proposal ); } $pdf->AddPage(); $pdf->MultiCell(170,5,""); $pdf->SetFont('freesans','B',9); $pdf->Cell(170,5,"Approvals:",0,0,'L'); $pdf->SetFont('freesans','',9); $pdf->MultiCell(170,5,""); $pdf->SetFont('freesans','',9,L); $pdf->MultiCell(170,5," $pdf->MultiCell(170,5,""); $pdf->SetFont('freesans','B',9); $pdf->Cell(170,5,"Additions and Alterations:",0,0,'L'); $pdf->SetFont('freesans','',9); $pdf->MultiCell(170,5,""); $pdf->SetFont('freesans','',9,C); $pdf->MultiCell(170,5," "); $pdf->MultiCell(170,5,""); $pdf->SetFont('freesans','B',9); $pdf->Cell(170,5,"Payments:",0,0,'L'); $pdf->SetFont('freesans','',9); $pdf->MultiCell(170,5,""); $pdf->SetFont('freesans','',9,L); $pdf->MultiCell(170,5,"The AGENCY is providing Online Marketing Services in advance of total payment. The CLIENT will have an initial down payment of $" . $bulk . ". that is due at the signing of this contract, " .$addtl_payment_msg. "Then an ongoing payment of $pdf->Cell $$total_recur[$recur], on a monthly basis for the following$pdf->Cell $recur months, starting from the date of signing this agreement. " ); $pdf->MultiCell(170,5,""); $pdf->AddPage(); $pdf->Image(ROOTDIR.'/assets/img/rwclogo.png', 63,10,75,'c'); $pdf->SetFont('freesans','B',11); $pdf->Ln(); $pdf->SetFont('freesans','B',9); $pdf->Ln(); $pdf->SetFont('freesans','',9); $pdf->MultiCell(39,5,""); $pdf->Ln(); $pdf->SetFont('freesans','B',9); $pdf->SetDrawColor(200); $pdf->SetFillColor(239); $pdf->SetFont('freesans','',9); $pdf->Cell(10,6,"Qty",1,0,'C','1'); $pdf->Cell(80,6,"Description",1,0,'C','1'); $pdf->Cell(20,6,"Recur",1,0,'C','1'); $pdf->Cell(20,6,"Term",1,0,'C','1'); $pdf->Cell(20,6,"Unit Price",1,0,'C','1'); $pdf->Cell(20,6,"Total",1,0,'C','1'); $pdf->Ln(); $pdf->SetFont('freesans','B',9); $total_onetime = 0; $total_recur = array(); foreach ($lineitems AS $item) { $description = $item["description"]; #========================================================================== # find term #========================================================================== $matches = array(); preg_match('/\[term:(.*?)\]/i', $description, $matches); if (empty($matches)) { $term = ''; } else { $term = strtolower(trim($matches[1])); $description = str_replace($matches[0], '', $description); } #========================================================================== # find recur #========================================================================== $matches = array(); preg_match('/\[recur:(.*?)\]/i', $description, $matches); if (empty($matches)) { $recur = ''; } else { $recur = strtolower(trim($matches[1])); $description = trim(str_replace($matches[0], '', $description)); } #========================================================================== # get unit price and total price #========================================================================== $matches = array(); preg_match('/\d+\.\d+/', $item['unitprice'], $matches); $item_unitprice = (float)$matches[0]; $matches = array(); preg_match('/\d+\.\d+/', $item['total'], $matches); $item_total = (float)$matches[0]; #========================================================================== # add onetime and recurring totals #========================================================================== if ($recur == '') { $total_onetime += $item_total; } else { if (!array_key_exists($recur, $total_recur)) { $total_recur[$recur] = 0; } $total_recur[$recur] += $item_total; } #========================================================================== # display line items #========================================================================== $numlines = ceil(strlen($description)/55); $cellheight = $numlines * 8; $pdf->MultiCell(10,$cellheight,$item["qty"],1,'C','',0); $pdf->MultiCell(80,$cellheight,$description,1,'L','',0); $pdf->MultiCell(20,$cellheight,$recur,'1','C','',0); $pdf->MultiCell(20,$cellheight,$term,'1','C','',0); $pdf->MultiCell(20,$cellheight,sprintf('$%.2f',$item_unitprice),1,'C','',0); $pdf->MultiCell(20,$cellheight,sprintf('$%.2f',$item_total),1,'C','',1); } $pdf->SetFont('freesans','B',9); /* $pdf->Cell(145,6,"Subtotal",1,0,'R','1'); $pdf->Cell(25,6,$currencysymbol.$subtotal,1,0,'C','1'); $pdf->Ln(); if ($taxlevel1["rate"]>0) { $pdf->Cell(145,6,$taxlevel1["name"]." @ ".$taxlevel1["rate"]."%",1,0,'R','1'); $pdf->Cell(25,6,$currencysymbol.$tax1,1,0,'C','1'); $pdf->Ln(); } if ($taxlevel2["rate"]>0) { $pdf->Cell(145,6,$taxlevel2["name"]." @ ".$taxlevel2["rate"]."%",1,0,'R','1'); $pdf->Cell(25,6,$currencysymbol.$tax2,1,0,'C','1'); $pdf->Ln(); } $pdf->Cell(145,6,"Total",1,0,'R','1'); $pdf->Cell(25,6,$currencysymbol.$total,1,0,'C','1'); $pdf->Ln(); */ if ($total_onetime > 0) { $pdf->Cell(150,6,'Pre-Pay',1,0,'R',1); $pdf->Cell(20,6,sprintf('$%.2f',$total_onetime),1,0,'C',1); $pdf->Ln(); } foreach (array('monthly', 'quarterly', 'semi-annually', 'annually', 'biennially') as $recur) { if (isset($total_recur[$recur]) && $total_recur[$recur] > 0) { $pdf->Cell(150,6,ucfirst($recur) . ' Monthly Payments',1,0,'R',1); $pdf->Cell(20,6,sprintf('$%.2f',$total_recur[$recur]),1,0,'C',1); $pdf->Ln(); } unset($total_recur[$recur]); } #========================================================================== # any remaining recurs #========================================================================== foreach ($total_recur as $recur => $amount) { $pdf->Cell(150,6,ucfirst($recur) . ' Monthly Payments',1,0,'R',1); $pdf->Cell(20,6,sprintf('$%.2f',$amount),1,0,'C',1); $pdf->Ln(); } $pdf->SetFont('freesans','',9,l); $pdf->MultiCell(170,5,"
  2. I have change php version 7.3 to 7.4 from cPanel. I also edit cron job command and change opt/alt/php73/usr/bin/php -q /*****/****/****/crons/cron.php to opt/alt/php74/usr/bin/php -q /*****/****/****/crons/cron.php but I got error on system health check page on my WHMCS. How can I solve this issue?
  3. while working with the api I realized that getproducts (https://developers.whmcs.com/api-reference/getproducts/) does not bring up the field to know if the product is active or not. I saw someone post a similar idea several years ago: so with a little engineer I made my own version of getproducts and uploaded it to /includes/api/ Request Parameters "GetProductsActive" Parameter Type Description Required action string “GetProductsActive” Required pid int string Obtain a specific product id configuration. Can be a list of ids comma separated gid int Retrieve products in a specific group id Optional Response Parameters Parameter Type Description result string The result of the operation: success or error totalresults int The total number of results available startnumber int The starting number for the returned results numreturned int The number of results returned products array An array of products matching the criteria passed I will leave the file called: getproductsactive.php however this may throw an api error, you have to give access in the table tblapi_roles in database, in the field: permissions add: ,"getproductsactive": 1 before closing }, This modification is due to WHMCS not showing the files added in includes/api as a role. (I do not know why). With this you can get the field: hidden which defines 0 if it is visible and 1 if it is hidden. (true or false also works) my code is a copy of includes/api/getproduct.php just add to show the hidden field (, "hidden" => $data["hidden"]), this would have been easier if WHMCS implemented it, it only took me 2 minutes to show this field. <?php if (!defined("WHMCS")) { exit("This file cannot be accessed directly"); } if (!function_exists("getCustomFields")) { require ROOTDIR . "/includes/customfieldfunctions.php"; } if (!function_exists("getCartConfigOptions")) { require ROOTDIR . "/includes/configoptionsfunctions.php"; } global $currency; $currency = getCurrency(); $pid = $whmcs->get_req_var("pid"); $gid = $whmcs->get_req_var("gid"); $module = $whmcs->get_req_var("module"); $where = array(); if ($pid) { if (is_numeric($pid)) { $where[] = "tblproducts.id=" . (int) $pid; } else { $pids = array(); foreach (explode(",", $pid) as $p) { $p = (int) trim($p); if ($p) { $pids[] = $p; } } if ($pids) { $where[] = "tblproducts.id IN (" . implode(",", $pids) . ")"; } } } if ($gid) { $where[] = "gid=" . (int) $gid; } if ($module && preg_match("/^[a-zA-Z0-9_\\.\\-]*\$/", $module)) { $where[] = "servertype='" . db_escape_string($module) . "'"; } $result = select_query("tblproducts", "tblproducts.*", implode(" AND ", $where), "tblproductgroups`.`order` ASC, `tblproductgroups`.`id` ASC, `tblproducts`.`order` ASC, `tblproducts`.`id", "ASC", "", "tblproductgroups ON tblproducts.gid = tblproductgroups.id"); $apiresults = array("result" => "success", "totalresults" => mysql_num_rows($result)); while ($data = mysql_fetch_array($result)) { $pid = $data["id"]; $productarray = array("pid" => $data["id"], "gid" => $data["gid"], "type" => $data["type"], "name" => $data["name"], "description" => $data["description"], "module" => $data["servertype"], "paytype" => $data["paytype"], "hidden" => $data["hidden"]); if ($language = $whmcs->get_req_var("language")) { $productarray["translated_name"] = WHMCS\Product\Product::getProductName($data["id"], $data["name"], $language); $productarray["translated_description"] = WHMCS\Product\Product::getProductDescription($data["id"], $data["description"], $language); } if ($data["stockcontrol"]) { $productarray["stockcontrol"] = "true"; $productarray["stocklevel"] = $data["qty"]; } $result2 = select_query("tblpricing", "tblcurrencies.code,tblcurrencies.prefix,tblcurrencies.suffix,tblpricing.msetupfee,tblpricing.qsetupfee,tblpricing.ssetupfee,tblpricing.asetupfee,tblpricing.bsetupfee,tblpricing.tsetupfee,tblpricing.monthly,tblpricing.quarterly,tblpricing.semiannually,tblpricing.annually,tblpricing.biennially,tblpricing.triennially", array("type" => "product", "relid" => $pid), "code", "ASC", "", "tblcurrencies ON tblcurrencies.id=tblpricing.currency"); while ($data = mysql_fetch_assoc($result2)) { $code = $data["code"]; unset($data["code"]); $productarray["pricing"][$code] = $data; } $customfieldsdata = array(); $customfields = getCustomFields("product", $pid, "", "", "on"); foreach ($customfields as $field) { $customfieldsdata[] = array("id" => $field["id"], "name" => $field["name"], "description" => $field["description"], "required" => $field["required"]); } $productarray["customfields"]["customfield"] = $customfieldsdata; $configoptiondata = array(); $configurableoptions = getCartConfigOptions($pid, array(), "", "", "", true); foreach ($configurableoptions as $option) { $options = array(); foreach ($option["options"] as $op) { $pricing = array(); $result4 = select_query("tblpricing", "code,msetupfee,qsetupfee,ssetupfee,asetupfee,bsetupfee,tsetupfee,monthly,quarterly,semiannually,annually,biennially,triennially", array("type" => "configoptions", "relid" => $op["id"]), "", "", "", "tblcurrencies ON tblcurrencies.id=tblpricing.currency"); while ($oppricing = mysql_fetch_assoc($result4)) { $currcode = $oppricing["code"]; unset($oppricing["code"]); $pricing[$currcode] = $oppricing; } $options["option"][] = array("id" => $op["id"], "name" => $op["name"], "rawName" => $op["rawName"], "recurring" => $op["recurring"], "required" => $op["required"], "pricing" => $pricing); } $configoptiondata[] = array("id" => $option["id"], "name" => $option["optionname"], "type" => $option["optiontype"], "options" => $options); } $productarray["configoptions"]["configoption"] = $configoptiondata; $apiresults["products"]["product"][] = $productarray; } $responsetype = "xml"; ?> Hope this helps others to show the field they need to show files and hidden products. getproductsactive.php
  4. Hello, I'm trying to get some way to query if a user is online. I don't want to know the current user. if not something you can define for example $clientid or $userid or $emailclient ... I am making an external site. and i need to work with user sessions. (I am making a remote connection with the api). this function does not currently exist in the api available. I've been seeing this: https://developers.whmcs.com/advanced/authentication/ however I do not see that it allows to define the user. I was also seeing this: https://docs.whmcs.com/Sessions I was able to save the cookie in the database, however I can't find any way to identify the one that belongs to each user. any idea how I can get (which users are online?) .. (please nothing to do with smarty, only php). postdata: forget to tell the method I use to get user authentication in my application. create the following code for my application: I first make a connection to the api: https://developers.whmcs.com/api/authentication/ soon ValidateLogin: https://developers.whmcs.com/api-reference/validatelogin/ soon GetClientsDetails: https://developers.whmcs.com/api-reference/getclientsdetails/ soon CreateSsoToken: https://developers.whmcs.com/api-reference/createssotoken/ // validar usuario $command = 'ValidateLogin'; $postData = array( 'email' => $email_user, //post 'password2' => $password_user, //post ); $api_login = localAPI($command, $postData); //var de id de usuario: $api_login["userid"]; // si se encuentra el user entonces traer detalles del usuario via email $clientid = array(); // array que tiene el id del cliente if ($api_login["userid"] == true) { $command = 'GetClientsDetails'; $postData = array( 'email' => $email_user, // email login ); $details_client = localAPI($command, $postData); $clientid[] = $details_client["client_id"]; } // variable del clientid es: $clientid[0]; // crear token de session $command = 'CreateSsoToken'; $postData = array( 'client_id' => $clientid[0], ); $results_ssotoken = localAPI($command, $postData); echo '<pre>'; var_dump($results_ssotoken); echo '</pre>'; this will create the url with (CreateSsoToken) where the user will be redirected for autologin, however the cookie is created only after entering the client area. that's why I don't know how to get the cookie, or identify the user. @brian! would you help me with this?
  5. Hello I have a variable that is printed with {debug} in the tpl template. however I want to get the result in php of this variable. I need to get $customfields from a hook. how could you access $customfields that is printed inside a product @brian! could you help me?
  6. 1. Plesk Extended For WHMCS 3.5.0 Because your system can never suffer from too many user-friendly features, today we are storming ahead with a solid update of Plesk Extended For WHMCS 3.5.0 that is about to nurture your web hosting business in more than a few different ways: Take maximum advantage of the newly introduced support for WHMCS V8.1 and "Twenty-One" theme. In order to limit the system resources consumed by PHP scripts, your clients are now allowed to use a custom PHP version and configurations per website. While in the comfy surroundings of the client area, let us also move a bit further to the new "Log Rotation" section where your customers can manage conditions for the log files to be cleaned up once they are too old or too big. Be sure to enjoy the full changelog available on our website! 2. SMS Center For WHMCS 3.8.0 Just as much deserving of a special mention is SMS Center For WHMCS, specifically because of its spanking-new 3.8.0 update! The module’s scope of support has been broadened to integrate well with as many as five all-new SMS gateways. Thanks to it, the official list of available SMS gateways now includes 51 providers in total! Additionally, the product has also received a series of tweak-ups so as to secure its rock-solid compatibility with both WHMCS V8.1 and "Twenty-One" system theme. Keep in touch with your customers no matter the time and place! 3. Under the Microscope: MetricsCube Live Dashboard for WHMCS Reading through your business data feels as though you were reading a foreign language? Live Dashboard for WHMCS that forms a central part of MetricsCube communicates crucial metrics in a visual format to make all complex relationships in your data self-explanatory. Drop by the MetricsCube blog as soon as you can to get a close-up look at every single report and graph illustrating the real-time performance of your WHMCS business down to the last detail. Take an insightful stroll through the data-filled confines of Live Dashboard! Need Custom Software Development For Your Business? Get Your Free Quote Now! Specially for you we will adapt an application and its design to your own needs, create a new module or even a completely new system built from scratch!
  7. Hi, How do I make a registration in html (php) sending a request to WHMCS? Example: <form action="{$systemsslurl}dologin.php?goto=clientarea.php" method="post" name="frmlogin"> <label>Email address</label> <input type="email" name="username" placeholder="Your Email"> <label>Password</label> <input type="password" name="password"> <button type="submit">Login</button> </form> <a href="/pwreset.php" >Forgotten your Password? Click Here</a> But how do I implement this for registration? is it possible to do this?
  8. 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.
  9. Hi, Sorry if this has been asked before but i can seem to find any solution for it! I am looking for a way to display a "Network Status" icon/ css on the home page of my website based on the WHMCS network status rss feed (https://portal.whmcs.com/networkstatusrss.php). The concept is to have the icon/css auto change when one of the following network issues are opened rather then having to change it manually. Low Medium High Critical Attached is an illustration of what i am looking at doing. PS: I already wrote the css to have pluse icons, just need to implement the second part. Thank you in advance! 😁
  10. What's the best way to add a snippet of PHP inside a .tpl file? It looks like everybody recommends against using the {php}{/php} bracket for security reason. Should I be creating my .php snippet file in root WHMCS directory and just using include to beam it in? {php} include "my-php-snippet.php"; {/php} I'm looking to "add recent wordpress posts to non wordpress site" and they all involve adding php snippet to include the wp-load.php file. It'd be cool if I can avoid using an <iframe> too. This is the snippet I'd like to add a .tpl page: <?php // Include the wp-load'er include('/public_html/wordpress/wp-load.php'); // Get the last 10 posts // Returns posts as arrays instead of get_posts' objects $recent_posts = wp_get_recent_posts(array( 'numberposts' => 10 )); // Do something with them echo '<ul>'; foreach($recent_posts as $post) { echo '<li><a href="', get_permalink($post['ID']), '">', $post['post_title'], '</a></li>'; } echo '</ul>'; ?> * whmcs 7.4 is installed on root domain, and the wordpress site is installed in a subfolder * https://davidwalsh.name/wordpress-recent-posts * https://www.webmoves.net/blog/web-design-development/display-wordpress-posts-outside-of-wordpress-3081/
  11. Hi, I wrote an PHP utility for importing domains from an old administrative panel. The utility creates new order then confirm it. We were using nicIT for .it domains and ascio for the others tld; all worked fine, A few days ago we added internetbs and now when trying to create the order for .com domains (still managed by ascio) the AddOrder API returns a null response although the order is created and left in 'pending' status. With .it domains still works fine. Any idea ? is it possible to get a sort of log where to look for the reason the API call does not work properly ?
  12. Hi All, On my System Health Status Page and the Dashboard it says..... PHP Version Your PHP version 7.2.29 is supported by WHMCS. The PHP 7.2 branch no longer receives regular bug fixes and will only receive critical security updates until it reaches its end of life. Please see our documentation for more information. but my Hosting Server is running version 7.4 of PHP (See Screenshot attached) Do i need to run something in WHMCS to update the System Health Page so the warning goes away ? I am Running WHMCS 7.10 (Latest Version), but the warning is not new and was also in previous WHMCS Version. Cheers Giles
  13. Hi guys, I have a php file executing some mysql queries with variables parsed by Ajax , this is why i can't do the queries directly in php tags in the WHMCS template. So basically there is a query.php file that i need to export the session variable to for further usage. I need this variable in that file {php} echo $_SESSION['uid']; {/php} so i can use it for further manipulations.
  14. I am trying to create a custom WHMCS page without any sidebars. I only want it to show the top bar where clients can choose language, etc. I have this code currently: <?php define("CLIENTAREA",true); //define("FORCESSL",true); // Uncomment to force the page to use https:// require("init.php"); $ca = new WHMCS_ClientArea(); $ca->setPageTitle("Support Center"); $ca->addToBreadCrumb('index.php',$whmcs->get_lang('globalsystemname')); $ca->addToBreadCrumb('support.php','HostAble Support'); $ca->addToBreadCrumb('support-center.php','Support Center'); $ca->initPage(); # Check login status if ($ca->isLoggedIn()) { # User is logged in - put any code you like here # Here's an example to get the currently logged in clients first name $result = mysql_query("SELECT firstname FROM tblclients WHERE id=".$ca->getUserID()); $data = mysql_fetch_array($result); $clientname = $data[0]; $ca->assign('clientname', $clientname); } else { # User is not logged in } # Define the template filename to be used without the .tpl extension $ca->setTemplate('supportcenter'); $ca->output(); ?> But obviously it isnt working, it just shows the page but with the sidebars and navigation bar too. Thank you if you can help me :)
  15. Hello, I'm working on an Addon Module to store a License Key for an addon. I can have it verify the get the license key from the table.. but what I'm trying to do is figure out how to put a check_license within this: class License extends Model { /** @var string $table The table in which the addon settings are stored. (mod_mylicensetable) */ protected $table = 'mod_squareLicensing'; //protected function results($results); private $vString = "16da9d4d6fc1e1ec25ce622d59d3d34e2b147bed894296693492985d85d27868"; } $Licensedata = License::where('id', '1')->first( As such, I can get my License data as expected, however, within the Addon Module itself -- to ideally get everything, the check needs to be inside the Class. I'd like to do something like function verify_license { //--get information from original license call and do our actions for invalid or active } Can someone give me guidance? I'm new working with Laravel. I know how to do a license call with the default check_sample.php and have adapted that as needed, and have built upon it.. but working with the classes are new to me. Any help and pointers would be greatly appreciated 🙂
  16. Hi all, Grizzlyware has just released Ranger for WHMCS, which will allow you to generate, manage and distribute license keys for software that you sell, via WHMCS. It's much like the WHMCS 'Licensing' module, however it has only just been released, so while it's fully functional and full featured, there is more to be added. We built Ranger to satisfy our own needs, it's open source and allows developers to license their software in the field. This is a WHMCS module which uses the Ranger framework. You can of course use the Ranger library on its own if you prefer. The module is bundled with email templates too. It's free - There is no charge for this module or the Ranger framework, all of the source code is available online as well as a packaged up WHMCS module. More information can be found here: https://www.grizzlyware.com/apps/whmcs/ranger/ We will have more WHMCS modules coming out in the not too distant future too. With that said, we just released 'Email Catcher' which scans your ticket replies for mismatched client email addresses (so you don't send an email address to the wrong client). Any questions or confusion, please give me a shout. Thank you, Josh
  17. 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');
  18. Hello, I got to thinking.. For the license module, if you have different license tiers, and want to offer auto upgrades.. Could you make a page like this: https://www.whmcs.com/members/autoupgrade.php With using bootstrap like that.. I know it's possible, but does this somehow manage a custom field within WHMCS? I've always thought about that! I'd love to know your thoughts, as I'd love to build something like it!
  19. Hello, I made a Square Gateway, which is in the Marketplace. The issue right now, is it's coded with PHP, and has to rely on allowing it to run with the php smarty tags, which aren't recommended. Is there an alternative way to avoid Smarty PHP tags? Thanks!
  20. I found a old pretty cool script and i would like to perform him because like as been reported before the hook put the admin area with infinite loops <?php add_hook('ClientAreaPage', 1, switch_language($vars)); function switch_language($vars) { $country_to_language = array( 'default' => 'english', 'AR' => 'arabic', 'AR-DZ' => 'arabic', 'AR-BH' => 'arabic', 'AR-EG' => 'arabic', 'AR-IQ' => 'arabic', 'AR-JO' => 'arabic', 'AR-KW' => 'arabic', 'AR-LB' => 'arabic', 'AR-LY' => 'arabic', 'AR-MA' => 'arabic', 'AR-OM' => 'arabic', 'AR-QA' => 'arabic', 'AR-SA' => 'arabic', 'AR-SY' => 'arabic', 'AR-TN' => 'arabic', 'AR-AE' => 'arabic', 'AR-YE' => 'arabic', 'AZ' => 'azerbaijani', 'CA' => 'catalan', 'ZH' => 'chinese', 'ZH-HK' => 'chinese', 'ZH-CN' => 'chinese', 'ZH-SG' => 'chinese', 'ZH-TW' => 'chinese', 'HR' => 'croatian', 'CS' => 'czech', 'DA' => 'danish', 'NL' => 'dutch', 'NL-BE' => 'dutch', 'EN' => 'english', 'EN-AU' => 'english', 'EN-BZ' => 'english', 'EN-CA' => 'english', 'EN-IE' => 'english', 'EN-JM' => 'english', 'EN-NZ' => 'english', 'EN-PH' => 'english', 'EN-ZA' => 'english', 'EN-TT' => 'english', 'EN-GB' => 'english', 'EN-US' => 'english', 'EN-ZW' => 'english', 'ET' => 'estonian', 'FA' => 'farsi', 'FR' => 'french', 'FR-BE' => 'french', 'FR-CA' => 'french', 'FR-FR' => 'french', 'FR-LU' => 'french', 'FR-MC' => 'french', 'FR-CH' => 'french', 'DE' => 'german', 'DE-AT' => 'german', 'DE-DE' => 'german', 'DE-LI' => 'german', 'DE-LU' => 'german', 'DE-CH' => 'german', 'HE' => 'hebrew', 'HU' => 'hungarian', 'IT' => 'italian', 'IT-CH' => 'italian', 'MK' => 'macedonian', 'NO' => 'norwegian', 'NB' => 'norwegian', 'NN' => 'norwegian', 'PT-BR' => 'portuguese-br', 'PT' => 'portuguese-pt', 'RO' => 'romanian', 'RO-MO' => 'romanian', 'RU' => 'russian', 'RU-MO' => 'russian', 'ES' => 'spanish', 'ES-AR' => 'spanish', 'ES-BO' => 'spanish', 'ES-CL' => 'spanish', 'ES-CO' => 'spanish', 'ES-CR' => 'spanish', 'ES-DO' => 'spanish', 'ES-EC' => 'spanish', 'ES-SV' => 'spanish', 'ES-GT' => 'spanish', 'ES-HN' => 'spanish', 'ES-MX' => 'spanish', 'ES-NI' => 'spanish', 'ES-PA' => 'spanish', 'ES-PY' => 'spanish', 'ES-PE' => 'spanish', 'ES-PR' => 'spanish', 'ES-ES' => 'spanish', 'ES-UY' => 'spanish', 'ES-VE' => 'spanish', 'SV' => 'swedish', 'SV-FI' => 'swedish', 'SV-SV' => 'swedish', 'TR' => 'turkish', 'UK' => 'ukranian', // NOTE: You can add more below ); if(!isset($_SESSION['switch-language']) && $_SESSION['uid'] == false) { $_SESSION['switch-language'] = true; // prevent from redirecting back again in this session } $current_country = strtoupper(substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2)); $language = $current_country != '' && isset($country_to_language[$current_country]) ? $country_to_language[$current_country] : $country_to_language['default']; if(!isset($_SESSION['Language']) || $_SESSION['Language'] != $language) { $location = '?language='.$language; if($_SERVER['QUERY_STRING'] != '') $location .= '&'.$_SERVER['QUERY_STRING']; ob_clean(); header('location: '.$location); die(); } } ?> some one have one idea to do a work arround, he give so many loops on admin area like this administator/?language=portuguese-pt&language=portuguese-pt&language=portuguese-pt&amp;lang... so there is any suggestion to fix this old good script he works great for client area but no for admin area ☹️ credits for, @webix @Remitur @brian!
  21. Hi @ all, got some problems with modifying the configuredomains.tpl This is what I have at the moment : This is what I would like to have : That's the part that drives me to despair : {foreach key=domainfieldname item=domainfield from=$domain.fields} <div class="form-group"> <label class="{$responsio.classes.col}-3 {$responsio.classes.label} control-label">{$domainfieldname}</label> <div class="{$responsio.classes.col}-8"> {if $domainfield.type == "tickbox"}<div class="checkbox {$responsio.classes.checkbox}">{$domainfield}</div>{else}{$domainfield|replace:"type=\"text\"":"type=\"text\" class=\"form-control `$responsio.classes.input`\""|replace:"type=\"password\"":"type=\"password\" class=\"form-control `$responsio.classes.input`\""|replace:"<select":"<select class=\"form-control `$responsio.classes.input`\""|replace:"<textarea":"<textarea class=\"form-control `$responsio.classes.input`\""|replace:"style=\"width:90%;\"":""}{/if} </div> </div>{/foreach} Maybe someone has an idea how I could solve it . Thanks and best regards Christian
  22. 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.
  23. 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!
  24. Hello everyone, Hope you guys doing good. I came up with something new or maybe old . I want to implement whmcs lang from English to Hindi. for my indian customers. So i will convert each and every English Words to hindi words. Already 50% done. but please anyone tell me how to Add a extension ex- Hindi in header dropdown menu and target it to my Hindi lang File. Check the screenshot for more info, So i have added a Hindi.php file in Lang directory but in dropdown its showing English 2 times. Sorry for my Bad English. Here is all. Thanks Bagful International
  25. Anyone have idea, how to show other domain registration in modern tpl? Thanks Madan Malhotra
×
×
  • 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