Jump to content


Popular Content

Showing content with the highest reputation on 10/08/19 in all areas

  1. 1 point
    Some people want to show their client's credit balance when they login to client area, as the option not implemented by default in Six Template here is how to do it: 1) Upload the PHP file from Attachements to -> /WHMCS-Path/includes/hooks/ directory. WHMCS_SixTemplateCreditBalance.zip
  2. 1 point
    if you're replacing, or adding to, text that is already there, you might be able to do it with a hook - though that is always dependent upon *where* you want to output the text. for example, let's assume that a product details [age contained a product from a product group of "Shared Hosting"... the basic hook below would add some text below that and before the product name... <?php # Product Details Additional Text Hook # Written by brian! function product_details_additional_text_hook($vars) { if ($vars['groupname'] == "Shared Hosting") { $groupname = $vars['groupname']."<br>Brian's Special Department"; return array("groupname" => $groupname); } } add_hook("ClientAreaProductDetailsPreModuleTemplate", 1, "product_details_additional_text_hook"); basically, the hook is just replacing an existing variable with itself plus additional text... if you wanted to add text in the template, then I suspect it would more likely be clientareaproductdetails.tpl rather than overview.tpl - but as always, that depends where the text is that you want to update.
  3. 1 point
    So i managed it myself. If anyone in future will need something similar to this: there is my solution: <?php $whmcsRoot = realpath(dirname(__FILE__)."/../").DIRECTORY_SEPARATOR; require_once($whmcsRoot."init.php"); $today = date('Y-m-d'); $unpaid_invoices = localAPI('GetInvoices', array( 'status' => 'Unpaid', 'limitnum' => 5000, 'orderby' => 'duedate', )); $unpaid_invoices_result = $unpaid_invoices['result']; // get array of all unpaid invoices if ($unpaid_invoices_result == 'success') { foreach ($unpaid_invoices['invoices']['invoice'] as $invoice) { $invoice_id = $invoice['id']; $invoice_total = $invoice['total']; // last day of payment invoice if ($invoice['duedate'] == $today) { // try to pay invoice from user balance $apply_invoice = localAPI('ApplyCredit', array( 'invoiceid' => $invoice_id, 'amount' => $invoice_total, )); if ($apply_invoice['result'] == 'success') { $apply_invoice_id = $apply_invoice['invoiceid']; logActivity("Automatic Invoice Closure: Invoice automatically $apply_invoice_id paid"); } else { $error_msg = $apply_invoice['message']; logActivity("Automatic Invoice Closure: ERROR: $invoice_id: $error_msg"); } } } } else { logActivity("Automatic Invoice Closure: ERROR: $unpaid_invoices_result"); } exit;
  4. 1 point
    Hi Harry, there's no point in reinventing the wheel, there's already a sidebar hook that does that... numerous variations and additions to that in the thread... i'd suggest using sentq's hook for this as it could be modified for your styling needs... that's expected behaviour - in v7, icons would be on the right; in v6, they used to be on the left... those positions are defined in the template... the usual way to get around it would be to use bodyhtml rather than a label... if you do that, you can put the FA code before the output...
  5. 1 point
    now I love a good screenshot with red arrows just as much as the next guy, but what's the point you're trying to make ? one invoice with a balance of 0.00 - perhaps you haven't marked it as paid ?? credit balance of $5 - it confirms the amount in the notifications... also, you might want to look into your WHMCS license situation, it's invalid. it might not have been the brightest of ideas to create an account here using your domain name (which btw is against the rules but seemingly never enforced) if you do not use a valid WHMCS license. 🙄
  6. 1 point
    Found the solution. The sample code provided by WHMCS assumes you want to use the WHMCS templating system. But if you do not want to use WHMCS's templating system and output your PHP code directly, then you have to take a different approach. First, you create a file in WHMCS's root directory that accesses WHMCS's session and sets variables: getuserid.php <?php // gets session variables from WHMCS require("init.php"); $ca = new WHMCS_ClientArea(); // sets userid for the logged in user. Is set to 0 if no one is logged in. $userid = $ca->getUserID() ; // sets loggedin to true if logged in, and false if not logged in. If ($userid > 0) { $loggedin = true; } else { $loggedin = false; } // if you want to test if it is working, uncomment this line. // echo "User ID = " . $userid; // if you want to test whether $loggedin variable is set, uncomment these 2 lines. // if ($loggedin) { echo "Logged in"; } // else { echo "Not logged in"; } ?> You can then include this in any PHP file you want anywhere in the file system. So if you want to put your custom code or third-party script in a subdirectory, you can. You would include the following code and then use the variable as needed. any.php <?php // use this if your file is in the same directory. require("getuserid.php"); // use this instead if your file is in a subdirectory. // require("../getuserid.php"); // test to make sure it is working. echo $userid; // use if then logic to determine what to show. if ($loggedin) { /* insert code for logged in users here */ } else { /* insert code for everyone else here */ } ?> Modify as needed, obviously. I hope that helps.
  7. -1 points
  • 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