Jump to content

twhiting9275

Member
  • Content Count

    1212
  • Joined

  • Last visited

  • Days Won

    17

twhiting9275 last won the day on February 9 2021

twhiting9275 had the most liked content!

Community Reputation

52 Excellent

About twhiting9275

  • Rank
    Just Me

Recent Profile Visitors

7844 profile views
  1. I mean, this is a billing system. These emails are somewhat important to receive. If they're dead set on not getting these though, you'll have to write a custom hook . Start by looking at EmailPreSend and work on from there. The following hook will get you to completely disable mail. You'll have to add custom user fields and then get this checked against those. You have the tools, go forth and learn to do it. <?php function no_invoice_email($vars) { $messagename = $vars['messagename']; $merge_fields['abortsend'] = TRUE; return $merge_fields; } add_hook("EmailPreSend",1,"no_invoice_email"); ?>
  2. huh? If you could elaborate, I'm sure you'd get better assistance here. What, exactly are you seeing, and what, exactly are you trying to prevent?
  3. If your module isn't compatible with the latest version of WHMCS, then you should contact the developer of the module, not hold back updating. That's just silly. A well done module won't break when WHMCS is updated, or, if it does, the developer will get on it as soon as possible. You just have to let them know
  4. Welcome to corporate life. This is very, very true, unfortunately. Surprised there hasn't actually been an addon built to deal with this already 🤔 If only I wasn't in the middle of about a zillion other projects at the moment. Good things on the way, Berry good things!!
  5. Just tested in 8.4.3 and it absolutely is working. Make sure you're using the code from this post , and that you're not logged in as admin (or have admnotify set to TRUE at the top)
  6. Double check your code. Dependency files, everything. Try running them through a debugger 1 by 1. 10:1, if the upgrade function isn't working, it's because something, somewhere , is broken inside code, and it can't work. I've seen this way, way too many times over the years
  7. Just out of curiosity, when was the last time you were able to get DecryptPassword to work for passwords (not encrypted strings). I do believe something's changed in the last few releases, as it does not accurately decrypt passwords any more. At least where WHMCS is concerned. Don't have access to cPanel at the moment to test this It used to do this, but they've changed something, somewhere
  8. On the subject of customizing with things like 'location': It's important to understand that this is not reliable. This is why this was originally left out of the hook. IP location relies on third party services, and the IP owner, actually being up to date and honest. When it comes to location, outside of the US, not terribly accurate. Even inside of the US , it can be inaccurate . Hell, I just checked my own IP against some of the popular sites claiming to be accurate, about a 30% failure rate as far as accuracy goes This is another one of those points of failure and confusion.
  9. 'not that hard is subjective, and you didn't provide any information in your post at all. Again, it's not documented. I had to read through it a couple times, and I've been dealing with WHMCS for a number of years If the user has to do more than copy and paste something into a file, in today's world, you're going to run into issues, and of course, those are passed on to others, and make finding and resolving problems even harder. When it comes to things like this, follow the KISS principle (look it up), and you'll have fewer problems. More working parts, more components, more chances of breakage and confusion
  10. <?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']; $admnotify = FALSE; //change this to true you want to send notifications when admin logged in.. //NOT advisable. this will let your clients know when you're logging into their account if (!empty($isadmin)) { if (!$admnotify) { 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); return; } 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(); $numrows = Capsule::table('tblusers_clients') ->where('auth_user_id', '=', $userid) ->count(); //we own our account. We must always notify us directly if ($acctowner > 0) { send_login_notify($userid); 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) { send_login_notify($clientid, $userid); return; } } } return; } } function send_login_notify($myclient, $theuserid="") { global $myver; $ip = $_SERVER['REMOTE_ADDR'] ; $hostname = gethostbyaddr($ip); if ($myver < 8) { $clientinfo = Capsule::table('tblclients')->select('firstname', 'lastname')->WHERE('id', $myclient)->get(); foreach ($clientinfo as $clrow) { $firstname = $clrow->firstname; $lastname = $clrow->lastname; } } if ($myver >= 8) { $clientinfo = Capsule::table('tblusers')->select('first_name', 'last_name')->WHERE('id', $myclient)->get(); foreach ($clientinfo as $clrow) { $firstname = $clrow->first_name; $lastname = $clrow->last_name; } } $command = "sendemail"; $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); } if ($myver < 8) { add_hook('ClientLogin', 1, 'hook_client_login_notify'); } if ($myver >= 8) { add_hook('UserLogin', 1, 'hook_client_login_notify'); } function get_whmcs_version() { $theversion = Capsule::table('tblconfiguration')->where('setting', '=', 'Version')->value('value'); $retver = substr($theversion, 0,1); return ($retver); } Updated version! 1 - there was an issue with 7.x installs pulling the greeting name (thusly causing the notification to bail) . I had the wrong table / values used in the last update. This version corrects that, and I've tested on 7.x all the way up to 8.1. All good 2 - I added an admnotify bool . This is a quick way to test that this is working, or to send notifications if you're logged in as an admin user (really not recommended, as it'll let users know when you're logging into their account, and give them your ip address). As far as templating and the like: The reason I chose not to do this (could have , years ago) was to reduce the confusion and possible areas of issues. This way, all you have to do is drop the code into a file and you're done.
  11. Please create your own thread for your modifications, rather than diluting this one. As it is, yours is not documented, and will end up causing confusion, because of this I realize that you think you're trying to improve this, but this isn't helping at all. As posted, your modification does not work, while the hook I created can indeed simply be cut and pasted into a file and works as posted on 8.0 and 8.1.
  12. This does indeed work in both 8.0 and 8.1 . Just updated (was waiting on theme devs to release an 8.1 theme) If you're not seeing this working on 8.0 or 8.1, then something is up with your install, but the hook (as of my last update) works like a charm The most common issue is going to be you being logged in to the admin area. You'll need to be logged out entirely, or use a different browser to test this. Not sure on 7.0 yet, haven't been playing around in that beast for a bit. Will do some digging on that this afternoon, as Brian did mention it seems to not.
  13. This hook works just fine in 7 and 8.0. haven't tried 8.1 yet, but I'm sure there won't be that many issues, if any at all.
  14. You're going to need to be more specific here. What, precisely, do you want to add? The title is rather vague, so you need to provide details.
  15. Honestly? I'd say no. Put some proper protection in against password failures and you're good 🙂
×
×
  • 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