STOP relying on email!

STOP relying on email!

Let WHMCS Notify Extended ensure that clients and staff get proper notifications of events!

Hackers are EVERYWHERE

Hackers are EVERYWHERE

Take control of your WHMCS installation with WHMCS  User and IP Control

WHMCS can be complicated

WHMCS can be complicated

Spend a few hours learning from a Guru! Training available

Don't get caught with your servers down!

Don't get caught with your servers down!

Let WHMCS Guru host your billing and support website, securely and remotely!

Importing from another billing client?

Importing from another billing client?

We can absolutely put together a script to take care of that for you

Need WHMCS Customized?

Need WHMCS Customized?

We’ve been developing addons, hooks and modules for WHMCS since 2007. Drop us a line

notification on admin login to WHMCS

Have you ever wanted to receive a notification on admin login to WHMCS? Well, this WHMCS hook does just this. It’s fairly straightforward, just copy and paste the following code into a file in  your whmcs/includes/hooks directory

 

<?php
/* admin login notification for WHMCS
retooled for v6
04-20-2016 - UPdated to use Capsule
*/

use Illuminate\Database\Capsule\Manager as Capsule;


function hook_email_adminonlogin($vars)
{
$adminid = $vars['adminid'];
if (!filter_var($adminid, FILTER_VALIDATE_INT))
{
return;
}
$ip=$_SERVER['REMOTE_ADDR'];

$admininfo = Capsule::table('tbladmins') ->select('username') ->where('id', '=', $adminid)->get();
foreach ($admininfo as $adminrow)
{
$ausername = $adminrow->username;
}

$subject = "[WHMCS] Admin login notification";
$body = "WHMCS Admin Login Notification for " . $ausername . " from " . $ip;

/* calling the local api to do the job */
$command = "sendadminemail";
$adminuser = "CHANGEME";
$values["type"] = "system";
$values["customsubject"] = $subject;
$values["custommessage"] = $body;

$results = localAPI($command,$values,$adminuser);
}

add_hook("AdminLogin",1,"hook_email_adminonlogin");
?>

Now, you will receive a notification on admin login to WHMCS , and you’re good to go!

Note:

You’ll have to change the $adminuser variable to one of your admin users  that has API access (usually a full admin user).

As always, if you have any questions or concerns, please do contact us. We’re always here and ready to help . If you need custom development done, we’re absolutely here to help with that as well! Just drop us a line.