Jump to content

leemahoney3

Member
  • Content Count

    215
  • Joined

  • Last visited

  • Days Won

    15

Everything posted by leemahoney3

  1. May run into the issue if the client has multiple unpaid invoices, which one would they be redirected to? Perhaps a redirection to the invoice page would work, but all payment related pages would need to be whitelisted in the hook.
  2. Hi, Did you resolve this? If not, try using a different web browser. If the issue persists, I'd suggest contacting WHMCS Support.
  3. Hi, Can you explain how you resolved this? Might be useful for others in the future.
  4. Could also be your email client, have you checked to see if the same results are replicated in other email clients?
  5. Hi, What exactly are you looking to do with $title and $bodyHtml ? You declare them but you've not passed them back to the sidebar.
  6. Not sure if setAttribute still works, can't test right now but give this a go: <?php #adding Menu Item to primaryNavbar use WHMCS\View\Menu\Item as MenuItem; add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) { $primaryNavbar->addChild('Premium Support') ->setUri('My url') ->setAttribute('target', '_blank') ->setOrder(70); });
  7. Hi, The $captureMinute variable should reference the minute after the hour that you want the cron to run on. E.g. if your cron runs every 1 or 5 minutes, then setting the $captureMinute variable to 10 would mean that it runs at 10 minutes past the hour (e.g. 00.10, 06.10, 12.10, 18.10) Setting it to 60 will not work, as your cron is running every five minutes, the following values will be acceptable: 05, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55
  8. Can you confirm the frequency of your cron? It should only run once per each hour that's defined in the hook.
  9. Looks like I had removed the print_r from the script on my GitHub, but not here. Sadly cant edit the original post now. Good shout on the Models, my reasoning for not using them is down to WHMCS's unpredictability to remove certain elements in later releases.
  10. Don't think this is natively possible, WHMCS only allows you to specify how many days before the due date the invoice is generated (System Settings > Automation Settings > Billing Settings > Invoice Generation). Could very easily be implemented though with a hook if you want all invoices to be generated on a specific day each month.
  11. It's possible WHMCS has changed how the crons are run, I'll have a look later. If you run the cron file manually (e.g. https://yourdomain.com/crons/cron.php), can you confirm it works? Check Last Cron Invocation under Automation Status.
  12. Hiya Dkuzik, Have you changed the directory of your crons folder? (e.g. outside of your public document root)
  13. Hi dewdropz, So I don't have the modules for Epik or ConnectReseller, however you just need to amend the values in the arrays below. Create a file in your /includes/hooks/ folder and paste the following code: <?php use WHMCS\Database\Capsule; if (!defined('WHMCS')) { die('You cannot access this file directly.'); } function pre_register_nameservers($vars) { $registrars = [ 'resellerclub' => [ 'ns1' => 'ns1.test.com', 'ns2' => 'ns2.test.com', 'ns3' => '', 'ns4' => '', ], 'connectreseller' => [ 'ns1' => 'ns3.test.com', 'ns2' => 'ns4.test.com', ], 'epik' => [ 'ns1' => 'ns5.test.com', 'ns2' => 'ns6.test.com', 'ns3' => 'ns7.test.com', ], ]; /* ------------------------------------------------- */ /* ONLY EDIT VARIABLES ABOVE THIS LINE */ /* ------------------------------------------------- */ $domain = $vars['params']['domain']; $domainDetails = Capsule::table('tbldomains')->where('domain', $domain)->first(); foreach ($registrars as $registrar => $nameservers) { if ($domainDetails->registrar != $registrar) { continue; } if (empty($nameservers)) { continue; } $nameservers = array_reverse($nameservers); $nameservers['domainid'] = $domainDetails->id; $command = localAPI('DomainUpdateNameservers', array_reverse($nameservers)); if ($command['result'] == 'error') { logActivity("Automatic nameserver assignment failed for {$domain} with error: {$command['error']}", $domainDetails->userid); } } } add_hook('AfterRegistrarRegistration', 1, 'pre_register_nameservers'); Edit the nameserver arrays as required, you don't need to include all nameservers, just the ones you wish to update. (Though I'd suggest defining them all and leaving the ones that are not needed blank) I've left in resellerclub as an example, you will need to update the names for epik and connectreseller if they are not correct. I don't have the modules so am unsure what they are called. However if you look up the tbldomains database table, the correct names will be listed under the registrar column. You will obviously need to update the nameservers also, I've just left them in as an example.
  14. Agreed, Lagom is quite highly customized and their support will be able to assist further.
  15. Hi dewdropz, I'll put one together for you later.
  16. Seeing as the one time and recurring price is effectively the same field in the database, no this is not possible natively. You'd need a custom module to achieve this.
  17. That addon seems to be causing a bit of upset lately! Remove the addons files completely (move them to a temporary folder outside of your whmcs installation if necessary) and check inside your /includes/hooks/ folder also. Likely something is lurking around.
  18. Bizarre, just tested that on my end and its not throwing any errors. If you look in your database, can you see the short_description column on the tblproducts table? Should be towards the end just before the tagline column.
  19. What version of WHMCS are you running? On the latest version (8.5.1) the column name is short_description, not shortDescription.
  20. Updated code, now allows you specify the minute on the hour you want to run the code (so it only runs once per hour!). E.g. If your cron is set to every five minutes (as yours is), then setting $captureMinute to 10 would mean the code will run on the 10th minute past the hour and not again until the next hour specified in the $captureHours array comes around. <?php use WHMCS\Carbon; use WHMCS\Database\Capsule; function cron_capture_payment($vars) { # How many days before the due date you wish to capture payment # e.g. if set to 3 and todays date is 6th Sept, only unpaid invoice due on the 9th Sept will be checked $daysBeforeDueDateToCapture = 0; # What hours of the day you wish to capture payment (e.g. '06' is 6am, '18' is 6pm) $captureTimes = ['00', '06', '12', '18']; # Which minute after the hour you wish this check to run at (e.g. if your cron is set to run every 5 minutes, can set this to 5, 10, 15, 20, 25, etc...) $captureMinute = 10; # If you only want to capture payments on certain payment methods, add them here (e.g. 'stripe', 'paypalcheckout') $allowedPaymentMethods = []; # If enabled and the capture fails, log the error in the clients log $logErrors = true; /* ------------------------------------------ */ /* ONLY EDIT VARIABLES ABOVE THIS LINE */ /* ------------------------------------------ */ # Grab the current time and date $currentTime = Carbon::now()->format('H'); $currentMinute = Carbon::now()->format('i'); $currentDay = Carbon::now()->format('Y/m/d'); # Check if the current hour is in the $captureTimes array if (in_array($currentTime, $captureTimes) && $currentMinute == $captureMinute) { # Calculate the due date based on the $daysBeforeDueDateToCapture variable $theDueDate = Carbon::now()->addDays($daysBeforeDueDateToCapture)->format('Y-m-d'); # Grab all unpaid invoices that match the due date $invoices = Capsule::table('tblinvoices')->where('duedate', $theDueDate)->where('status', 'Unpaid')->get(); # Loop through the invoices foreach ($invoices as $invoice) { # If the $allowedPaymentMethods is not empty, check that the invoice's payment method is in it if (!empty($allowedPaymentMethods) && !in_array($invoice->paymentmethod, $allowedPaymentMethods)) { return; } # Attempt to capture payment $result = localAPI('CapturePayment', [ 'invoiceid' => $invoice->id ]); print_r($result); # If $logErrors is true and an error is present, log it to the clients log if ($result['result'] === 'error' && $logErrors) { logActivity("Automatic payment capture hook failed on invoice #{$invoice->id}: {$result['message']}", $invoice->userid); } } } } add_hook('AfterCronJob', 1, 'cron_capture_payment');
  21. whmpca is related to WHMPress. Have you temporarily disabled all addons and hooks? Strange that nothing shows in any of logs.
×
×
  • 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