notification on admin login to WHMCS
notification on admin login to WHMCS
Have you ever wanted to receive anotification 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.
Reactions
Search
Categories
All Posts
All Categories
Business
7
development
15
News
2
Template modifications
2
Tips and Tricks
7
Uncategorized
2
WHMCS Modifications
17
Tags
Adding 2
Addon 1
Addons 7
Admin 1
Admin Area 5
Ahead 1
API 2
Around 1
Authentication 1
Barely 2
Basics 1
Bumps 1
Business 3
Capsule 1
Certificate 1
Changing 1
Client 1
Client Area 10
Coming 2
Communicating 1
Corner 1
cPanel 1
Cron Jobs 1
Cron Notifications 3
Database 12
development 12
Disabling 1
Discord 1
Display 1
Domain 3
Domains 3
Downs 1
Email 7
Extended 8
Factor 1
Farewell 2
Files 1
Further 1
GDPR 1
Hooks 7
Increase 1
Information 1
Invoice 1
Invoices 5
IP Control 3
Keeping 1
Laravel 3
Licensing 1
Logged 1
Login 1
Major 1
Modifications 1
Modules 10
Mynewaddon 1
MySQL 3
new platform 1
new site 1
News 2
Notification 2
Notification Methods 1
Notifications 9
Notify 10
Notify Extended 20
Password 1
PHP 15
Problem 1
Problems 1
Productivity 1
Pushalot 1
Pushbullet 1
Pushover 3
Queries 3
Quick 2
Renew 1
Renewal 1
Right 1
Schema 1
Security 4
Server 1
Service 1
Serving 1
Slack 2
Sneak 1
Speed 1
SSL 2
Stuff 1
Support Tickets 3
Telegram 2
Template 1
Templates 8
Tickets 8
Tips and Tricks 11
Tools 2
Track 1
Tricks 11
Troubleshooting 2
Twilio 5
Two Factor Authentication 1
Understand 1
Understanding 1
Uniquecolumn 1
updates 1
Upgrade 2
Upgrades 1
Upgrading 1
Username 1
Users 1
v3 1
Webhooks 1
website 1
Welcome 8
WhatsApp 8
WHMCS 51
whmcs guru 1
WHMCS Notify 19
WHMCS Notify Extended 18
WHMCS User 3
WHMCS User and IP Control 3
Wrong 1