Jump to content

wtricks

Retired Forum Member
  • Posts

    20
  • Joined

  • Last visited

Everything posted by wtricks

  1. I'm not sure how this works. I setup all the tax configurations conrrectly. If I add the client's VAT from the profile and save, the client gets marked as tax exempt correctly (tyhis is the expected behaviour. If the client orders and insterts that same tax id, vat is charged. Here the expected behaviour would be to check the vat id on vies and make it tax exempt. If I go on the cliet's profile after he orders, make no modifications and save, he's marked as tax exempt. What should I check? what am I doing wrong?
  2. lol, it works and is improved, all one has todo is to create a template and a custom field after checking my code, not that hard. but maybe you are right, why wasting my time trying to help, ignore my broken version lol
  3. You can check my version, it works on 8.1, using email template and custom field to make it better
  4. I improved it (hope so) not it uses a template email (useful if you want it multilanguage) and checks a client's custom field. So if the client down't want to receive this notification he can stop this. <?php /* Client area login notifications for WHMCS (works with versions 6-8) Created by whmcsguru Contributions by brian! */ use WHMCS\Database\Capsule; $myver = get_whmcs_version(); $isadmin = $_SESSION['adminid']; if (!empty($isadmin)) { //go no farther, get out of here.. No login notifications necessary return; } function hook_client_login_notify($vars) { $mailsent=FALSE; global $myver; $myver = get_whmcs_version(); if ($myver < 8) { $userid = $vars['userid']; send_login_notify($userid); } if ($myver >= 8) { $user = $vars['user']; $userid = $user->id; //a dirty hack to try to work around a couple of things, maybe $acctowner = Capsule::table('tblusers_clients') ->where('auth_user_id', '=', $userid) ->where('owner', '=', 1) ->count(); $client_id = Capsule::table('tblusers_clients') ->where('auth_user_id', $userid) ->value('client_id'); $numrows = Capsule::table('tblusers_clients') ->where('auth_user_id', '=', $userid) ->count(); //controlla il customfield $cfid = Capsule::table('tblcustomfields')->where('fieldname', 'Notifica email login')->where('type', 'client')->where('fieldtype', 'tickbox')->value('id'); //we own our account. We must always notify us directly if ($acctowner > 0) { if( !Capsule::table('tblcustomfieldsvalues')->where('fieldid', $cfid)->where('relid', $client_id)->where('value', 'on')->exists() ) { send_login_notify($client_id); return; } } //we don't own our account, so, notify the owner, if we only exist once. if ($numrows < 2) { foreach (Capsule::table('tblusers_clients')->WHERE('auth_user_id', '=', $userid)->get() as $userstuff){ $userid = $userstuff->auth_user_id; $clientid = $userstuff->client_id; $owner = $owner; if ($acctowner < 1) { if( !Capsule::table('tblcustomfieldsvalues')->where('fieldid', $cfid)->where('relid', $clientid)->where('value', 'on')->exists() ) { send_login_notify($clientid, $userid); return; } } } } return; } } function send_login_notify($myclient, $theuserid="") { $ip = $_SERVER['REMOTE_ADDR'] ; $hostname = gethostbyaddr($ip); $clientinfo = Capsule::table('tblusers')->select('first_name', 'last_name')->WHERE('id', $myclient)->get(); //greet them foreach ($clientinfo as $clrow) { $firstname = $clrow->first_name; $lastname = $clrow->last_name; } $command = "sendemail"; $values["messagename"] = "Account login notification"; if ($theuserid > 0) { $subaccount = true; $moreinfo = Capsule::table('tblusers')->select('first_name', 'last_name', 'email')->WHERE('id', $theuserid)->get(); //greet them foreach ($moreinfo as $userrow) { $firstname = $userrow->first_name; $lastname = $userrow->last_name; $uemail = $userrow->email; } } $values['customvars'] = base64_encode( serialize( array( "login_email"=> $uemail, "ip"=> $ip, "hostname"=> $hostname, "subaccount"=> $subaccount, "logintime"=> date('d-m-Y H:i:s') ) ) ); /* $values["customtype"] = "general"; if (empty($theuserid)) { $values["customsubject"] = "Account Login from $hostname"; $values["custommessage"] = "<p>Hello $firstname $lastname,<p>Your account was recently successfully accessed by a remote user. If this was not you, please do contact us immediately<p>IP Address: $ip<br/>Hostname: $hostname<br />"; } elseif ($theuserid > 0) { $moreinfo = Capsule::table('tblusers')->select('first_name', 'last_name', 'email')->WHERE('id', $theuserid)->get(); //greet them foreach ($moreinfo as $userrow) { $ufirst = $userrow->first_name; $ulast = $userrow->last_name; $uemail = $userrow->email; } $values["customsubject"] = "Subaccount Login from $hostname"; $values["custommessage"] = "<p>Hello $firstname $lastname,<p> A subaccount of yours just logged in. Please see the details of the login below <p> Name: $ufirst $ulast Email: $uemail IP Address: $ip Hostname: $hostname<br />"; } */ $values["id"] = $myclient; $results = localAPI($command, $values); } function get_whmcs_version() { $theversion = Capsule::table('tblconfiguration')->where('setting', '=', 'Version')->value('value'); $retver = substr($theversion, 0,1); return ($retver); } if ($myver < 8) { add_hook('ClientLogin', 1, 'hook_client_login_notify'); } if ($myver >= 8) { add_hook('UserLogin', 1, 'hook_client_login_notify'); }
  5. I have a cms hosting product. I'm asking my customers (using custom fields) to fill some data (script, username, password, language) of course this is pointless if they are transferring their domain, as there is no need to install the script (and ask for those data) if the client will need to transfer the website. I have this code: add_hook('ClientAreaPageCart', 1, function($vars) { $pids = Array(17085, 17087); if( !empty($vars['customfields']) ) { $key = array_search($vars['domain'], array_column($_SESSION['domain_cart']['domains'], 'domain')); $key2 = array_search($vars['domain'], array_column($_SESSION['domain_cart']['products'], 'domain')); $type = $_SESSION['domain_cart']['domains'][$key]['type']; if ( $type == 'transfer' && in_array($vars['productinfo']['pid'], $pids) ) { foreach ( $vars['customfields'] as $key => $value ) { unset($vars['customfields'][$key]); } } } return $vars; }); it actually works well but has a problem, since the fields are required, you get an error as they are required. At least I got half the job done, I made them disappear ;) I tried this: $vars['customfields'][$key]['required'] = ''; with no success. also set the fileds as not required and then if the domain is not transfer set this: $vars['customfields'][$key]['required'] = '*'; bus seems like the validation is ignoring my hook what can you recommend to hide custom fields if the domain is a transfer?
  6. a better screenshot for the results of the same page...
  7. Thanks for your reply, this is weird. I tested this on gtmetrix: cart.php?a=add&pid=129&billingcycle=annually&language=italian&systpl=six and see as in the attachment this page definitely doesn't need any stripe script, the client has to check the domain for his account still
  8. I'm having some speed issues and I'd like to remove stripe JavaScripts from pages where it's not needed. (in the end they are only needed when the client has to pay woth card, in all other pages it's just slowing down Any advices on how to do that?
  9. Hello John, I have a question for you. I have a product that has monthly, annually, biennially and triennially prices. let's assume I want to charge 1 $ for an email address every year. what price shall I add in the metric billing? I've done some tests, I put 1 in the pricing field . for the product billend monthly that email costs 1$ a month, for the product with the annual billing the same costs 1$ every year. I hope I am doing something wrong. How can I charge 1$ per month (if the product is billed monthly) and 12$ per year if billed yearly and so on?
  10. I just noticed that some data are wrong when checking the affiliate commissions as client. in this case 1 product was ordered but never paid, so commission should show at 0€ in 2 cases clients had a discount on first term, so the commission is a percentage of the first payment, but in the client table it shows ad 15% or the recurring amount. Do you have any solutions to this to avoid creating an hook and edit the template to solve?
  11. this option is selected: Add Grace and Redemption Fees to existing invoice this is why I don't understand why some domains are removed from the invoice. As I was showing you, on the same day (so same cron run) ad te same time for teh 2 domains there was a different outcome. Domains have the same extension, and the redemption fee is set correctly (left the numbers of days empty to use default, set the price to 25) I just checked, the domain that has been removed from the invoice does not have a space at the end (I thought maybe a space at the end would be invisible at the human eye and be seen as adifferent extension but that's not the case)
  12. I have the same problem, and the issue doesnt make much sense... on the same day, 2 different invoices: from mysql: 24435 13559 2248 DomainRedemptionFee 2539 Costo di recupero del dominio in Redemption Period... 25.00 0 2020-02-25 paypal from activity log 25/02/2020 07:03 Removed Domain Renewal Line Item - Invoice ID: 13244 - Domain: XXXXXXXX.it System both domains have the same extension, the redemption fee is set correctly. Why do you think this is happening?
  13. I'd edit the template file adding and if. use {debug} to find the variable then enclose everything into an if
  14. thanks brian, it worked perfectly. for the records I tried (only difference is raw instead of select): $replies = Capsule::raw("SELECT * FROM `tblticketreplies` where tid IN (SELECT id FROM `tbltickets` WHERE userid = '0' and date > DATE_SUB(NOW(), INTERVAL 1 MONTH)) AND id in (SELECT max(id) FROM `tblticketreplies` GROUP BY tid ) and DATE(date) > DATE(DATE_SUB(NOW(), INTERVAL 7 DAY)) order by id desc"); and it doesn't work (I don't need it, this is ok already
  15. I need to run this query: SELECT * FROM `tblticketreplies` where tid IN (SELECT id FROM `tbltickets` WHERE userid = '0' and date > DATE_SUB(NOW(), INTERVAL 1 MONTH)) AND id in (SELECT max(id) FROM `tblticketreplies` GROUP BY tid ) and DATE(date) > DATE(DATE_SUB(NOW(), INTERVAL 7 DAY)) order by id desc but I'm having problems, since I can't seem to make it work using raw (not really experienced with laravel query builder. I tried with $replies = Capsule::raw(SELECT * FROM `tblticketreplies` where tid IN (SELECT id FROM `tbltickets` WHERE userid = '0' and date > DATE_SUB(NOW(), INTERVAL 1 MONTH)) AND id in (SELECT max(id) FROM `tblticketreplies` GROUP BY tid ) and DATE(date) > DATE(DATE_SUB(NOW(), INTERVAL 7 DAY)) order by id desc); But no luck. do you know how to do this?
  16. you can search custom client fields if you go on clients -> view/search clients you can make a hook and add what you want to the intelligent search: https://developers.whmcs.com/hooks-reference/everything-else/#intelligentsearch you might get too many results out though
  17. Might be a late reply... we just released a hooks that does exactly this. This hook runs after all the automations and set the invoices to “Cancelled” it the services have been terminated or cancelled. This feature has been long requested to WHMCS but it was never implemented. You can find more info and buy it here: https://whmcstricks.com/cancel-invoice-for-terminated-and-cancelled-services/
  18. As a business you send many important e-mails to your customers. Invoices, renewal notices, quotes, and important announcements are just a few of the many things you may communicate to your customers via e-mail. Wouldn't it be great if you could tell if your customers have read the e-mails you have sent? Now you can! WhmcsTricks E-mail Status allows you to track the e-mails you send, and see which ones have been opened. Once this module is activated an invisible tracking pixel will be added to the footer of all e-mails sent by WHMCS to your customers, and you can see which messages have been read from the WHMCS Administration Area. E-mail Tracking This module allows you to see which e-mails have been opened from the "Emails" tab on the "Client Profile" page in WHMCS. You can also see the date the e-mail was opened, and the IP address that was logged when the message was viewed. If the email hasn't been read yet you will see a red icon. If you see no icon it means that the email was sent before activating the module. Ticket Open Tracking Once you answer a ticket check if the client read your last answer or if that was not read yet. If you don't see any box on top of the ticket page it means tracking is not active (check the module page) or that the ticket emails were sent before you activated the module. Statistics Easily get a quick overview of how many e-mails you are sending, and how many of them are being opened, from the WhmcsTricks E-mail Status summary page. You can calculate the open rate of an email campaign (you can make a search using a specific subject). You can insert the subject of your mailing list in the box to calculate the open rate of your mass email. You can use "%" as a wildcard in case you were using a dynamic parameter in your subject (for example "hello % here is your discount" where % was the name of every customer). Pricing The module is available on an annual license for 25$ for a lifetime license. Installation and Configuration To install the module: Upload the folder th_es inside the /modules/addons folder of your WHMCS installation From your WHMCS Admin Panel, go to "Setup > Addon Modules" Click the "Activate" button beside the WhmcsTricks E-mail Status module On the same page, scroll down and click the "Configure" button beside the WhmcsTricks E-mail Status module Select all permission groups that you want to be able to use this module, and click "Save Changes" From your WHMCS Admin Panel, go to "Addons > WhmcsTricks E-mail Status" To configure the module: You need to add a tag in your email footer, just before the end of the body to include the tracking. If you want to track the ticket emails as well you need to log email ticket replies. Everything is explained in the documentation and in the alerts. Once everything is configured correctly you will see a success message. For information, screenshot and pricing: https://whmcstricks.com/whmcstricks-email-status/
  19. Thanks for your help, I deactivated all the modules and hooks, cleared the cache and found the problem and solved it.
  20. When I go to the email log: systememaillog.php I can see al the sent emails, click on the subject and see the email in a new window. Why can't I click on the subject in the client email tab? (clientsemails.php?userid= ) that doesn't make much sense to me.
×
×
  • 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