Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About wtricks

  • Rank
    Junior Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  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?
  • 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