-
Posts
16 -
Joined
-
Last visited
-
Days Won
1
LosBooom last won the day on July 26 2022
LosBooom had the most liked content!
About LosBooom

Recent Profile Visitors
1376 profile views
LosBooom's Achievements
Junior Member (1/3)
3
Reputation
-
Checking if account has active SSL from clientareahome.tpl
LosBooom replied to Jomart_123's topic in Developer Corner
Perhaps the code in the modules/reports/ssl_certificate_monitoring and templates/twenty-one/clientareadomaindetails files will help. In general, you can use $clientSslStatuses = WHMCS\Domain\Ssl\Status::where("user_id", $userid)->get(); $sslStatus = WHMCS\Domain\Ssl\Status::factory($userid, $domain);- 2 replies
-
- SSL
- ssl certificate
-
(and 1 more)
Tagged with:
-
I usually do it with https://developers.whmcs.com/hooks-reference/everything-else/#emailpresend File to add in includes/hooks <?php use WHMCS\Database\Capsule; add_hook('EmailPreSend', 3, function ($vars) { $order_id = $vars['mergefields']['order_id']; if ($vars['messagename'] == 'Order Confirmation' && !empty($order_id)) { $invoiceid = Capsule::table('tblorders')->select('invoiceid')->where('id', $order_id)->first()->invoiceid; if ($invoiceid) { $invoice_num = Capsule::table('tblinvoices')->select('invoicenum')->where('id', $invoiceid)->first()->invoicenum; if ($invoice_num) { return ['invoice_num' => $invoice_num]; } } } }); Inside "Order Confirmation" template use like : {if $invoice_num}Invoice num: {$invoice_num}{/if} I recommend checking it in a test environment before using it in production.
-
How to create 1k promocodes without any plugins
LosBooom replied to twister's topic in Admin & Configuration Questions
You can always use tblpromotions table to add your promocodes by sql/php scripts without using admin area. -
It is possible to change the index via SQL: ALTER TABLE tblaffiliates AUTO_INCREMENT=5000; But remember that there is a limit: https://dev.mysql.com/doc/refman/8.0/en/alter-table.html And I highly recommend testing before making changes in production.
- 1 reply
-
1
-
In general, the task is quite straightforward, since there is access to editing the file *. You can write a fairly simple module that will extend tblaffiliates and give clients a form to change usernames in affiliate links that will solve your problem. If you do not have a person who knows how to program for whmcs, then there are companies on the community that make such extensions for money.
-
$account = $primarySidebar->getChild('Account'); if (!is_null($account)) { $accountDetails = $account->getChild('Edit Account Details'); if (!is_null($account)) { $accountDetails->moveUp(); } } Somewhat late, but it will be useful for history. You must check for the existence of objects before calling them.
-
LosBooom changed their profile photo
-
Hello. When I assign an employee to a ticket through the admin ticket viewing form, to my employee comes email from Email templates > Admin messages > Support Ticket Change Notification. But when i use WHMCS API like so: $assignTicket = localAPI('UpdateTicket', [ 'ticketid' => $tickeid, 'flag' => $adminid, ]); there is no notification. 1. I regard this as an API bug. Are there any ways to fix this? 2. How can I manually send an email to only the employee to whom the ticket is assigned? It seems that SendEmail and SendAdminEmail not suitable for me.
-
Check this out: https://developers.whmcs.com/hooks-reference/ticket/#ticketopen <?php add_hook('TicketOpen', 1, function($vars) { // $vars['ticketed']; }); https://developers.whmcs.com/hooks/hook-index/
-
Yes, this completely solved our problem. WHMCS Support was able to determine at what stage of the hooks there was a problem and we were able to find a module that behaved inappropriately and did break "Cron Job: Running Usage Stats Update for Server".
-
The problem was in 3rd party module, which was breaking automation tasks by whmcs.
-
Hello. Can someone explain why this is happening? I have this code in includes/hooks: <?php if (!defined("WHMCS")) { die("This file cannot be accessed directly"); } add_hook('TicketOpen', 1, function($vars){ $ticketid = 111115; // use this ticket for testing $result = localAPI('AddTicketReply', [ 'ticketid' => $ticketid, 'message' => 'Text message', 'adminusername' => 'Robot admin', ]); }); ?> My idea is this: the user opens a ticket, a hook is triggered, a message from Robot Admin is sent to the test ticket. The problem is that if the user attaches files to the ticket, the robot will repeat it in my test ticket.
-
I found out that its floating error. 2 days ago DailyCronJob hook was triggered normally, but today it wasn't. Most likely some script that works on this hook is broken. How can I identify a weak spot in the system?
-
Hello. I think that in some updates DailyCronJob hook was broken. I have some modules and scripts which use DailyCronJob hook and some of scripts stop working. I added this code to my hooks will post results tomorrow. Maybe there are more options how to find and fix the problem? Thank you.
-
Automatically withdraw funds on the last day
LosBooom replied to LosBooom's topic in Developer Corner
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; -
Automatically withdraw funds on the last day
LosBooom replied to LosBooom's topic in Developer Corner
So my idea: Go through the list of all unpaid invoice whose duedate = today. The code: $ command = 'GetInvoices'; $ postData = array ( 'status' => 'Unpaid', 'limitnum' => 25, ‘duedate’ => $ today; 'orderby' => 'invoicenumber', ); $ results = localAPI ($ command, $ postData); if ($ results ['result'] == 'success') { $ total_unpaid_invoices = $ results ['totalresults']; echo "Total number of unpaid invoices". $ total_unpaid_invoices. "<br>"; foreach ($ results ['invoices'] ['invoice'] as $ invoice) { echo $ invoice ['userid']; echo $ invoice ['duedate']; echo $ invoice ['total']; } } Is there an api call to automatically pay invoice and debit from the user's balance or do I need to write my own code?
