I use the notifications module on every V1 site. It's great, it notifies me by email every time an admin logs in to the backend. So I can easily see which clients are updating their sites - and which are not. It also emails me on every unsuccessful backend login (e.g. wrong password) so I can tell if someone, or something, is trying to hack in.
I would like to continue using it in V2 but it hasn't been updated in a while and it is unlikely to be updated because it was created by a couple of guys who have left the CMSMS world:
http://dev.cmsmadesimple.org/projects/notifications
I tried installing in to a V 2.1.3 site - it seemed to install without error but unsurprisingly it did not work, giving a white unstyled page when accessing the admin page.
Is there an alternative method of getting the functionality described without using this module?
Thanks
Notifications module - V2 alternatives? Sends email on event
- paulbaker
- Dev Team Member
- Posts: 1465
- Joined: Sat Apr 18, 2009 10:09 pm
- Location: Maidenhead, UK
- Contact:
Notifications module - V2 alternatives? Sends email on event
To copy System Information to the forum:
https://docs.cmsmadesimple.org/troubles ... nformation
CMS Made Simple Geekmoots attended:
Nottingham, UK 2012 | Ghent, Belgium 2015 | Leicester, UK 2016
https://docs.cmsmadesimple.org/troubles ... nformation
CMS Made Simple Geekmoots attended:
Nottingham, UK 2012 | Ghent, Belgium 2015 | Leicester, UK 2016
Re: Notifications module - V2 alternatives? Sends email on e
Yep, a simple Mail UDT like http://docs.cmsmadesimple.org/general-i ... s#mail-udt
Ps. I also use it for http://www.cmscanbesimple.org/blog/mous ... ate-errors
Ps. I also use it for http://www.cmscanbesimple.org/blog/mous ... ate-errors
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
- paulbaker
- Dev Team Member
- Posts: 1465
- Joined: Sat Apr 18, 2009 10:09 pm
- Location: Maidenhead, UK
- Contact:
Re: Notifications module - V2 alternatives? Sends email on e
Thanks for the swift reply Rolf!
I tried the Mail UDT. It worked great. So I am now notified on a failed login.
I made a similar UDT and linked it to the LoginPost event, hoping to be told every time someone successfully logs in. The UDT fires OK but the $_POST["username"] field is blank. It would be great if anyone had some ideas on that.
I tried the Mail UDT. It worked great. So I am now notified on a failed login.
I made a similar UDT and linked it to the LoginPost event, hoping to be told every time someone successfully logs in. The UDT fires OK but the $_POST["username"] field is blank. It would be great if anyone had some ideas on that.
To copy System Information to the forum:
https://docs.cmsmadesimple.org/troubles ... nformation
CMS Made Simple Geekmoots attended:
Nottingham, UK 2012 | Ghent, Belgium 2015 | Leicester, UK 2016
https://docs.cmsmadesimple.org/troubles ... nformation
CMS Made Simple Geekmoots attended:
Nottingham, UK 2012 | Ghent, Belgium 2015 | Leicester, UK 2016
Re: Notifications module - V2 alternatives? Sends email on e
Code: Select all
$_SESSION['login_user_username']
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Re: Notifications module - V2 alternatives? Sends email on e
LoginPost
Description: Sent after a user logs into the Admin panel
Parameters
'user' - Reference to the affected user object.
Event Handlers
None
Re: Notifications module - V2 alternatives? Sends email on e
Generic (for both failed en success):
Personally I'd rather use the CMSMS api to send the email out (instead of 'mail') but don't have time now to find out how.
Code: Select all
$to = 'YOUREMAIL@YOURDOMAIN.COM';
$headers = 'From: CMS Made Simple website.com <noreply@website.com>';
$user = $params['user'];
if ($params['_eventname'] == 'LoginPost') {
$subject = 'Successful login: ' . $user->username . ' - ' . cms_utils::get_real_ip();
$message_template =<<<'EOD'
There has been a successful login in your admin panel.
Username: %s
IP Address: %s
First Name: %s
Last Name: %s
Email %s
EOD;
$message = sprintf($message_template,
$user->username,
cms_utils::get_real_ip(),
$user->firstname,
$user->lastname,
$user->email
);
} elseif($params['_eventname'] == 'LoginFailed') {
$subject = 'Failed login: ' . $user . ' - ' . cms_utils::get_real_ip();
$message_template =<<<'EOD'
There has been a failed login in your admin panel.
Username: %s
IP Address: %s
EOD;
$message = sprintf($message_template,
$user,
cms_utils::get_real_ip()
);
}
@mail($to, $subject, $message, $headers);
Last edited by velden on Thu May 19, 2016 10:20 am, edited 1 time in total.
Reason: Removed 'Is Admin' from code
Reason: Removed 'Is Admin' from code
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
- Location: Fernie British Columbia, Canada
Re: Notifications module - V2 alternatives? Sends email on e
in 2.x:
$mailer = new cms_mailer();
$mailer->SetSubject($subject);
$mailer->SetBody($body);
$mailer->AddAddress($email_address);
$mailer->Send();
$mailer = new cms_mailer();
$mailer->SetSubject($subject);
$mailer->SetBody($body);
$mailer->AddAddress($email_address);
$mailer->Send();
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Re: Notifications module - V2 alternatives? Sends email on e
Extended version of Veldens UDT
http://www.cmscanbesimple.org/blog/admi ... tification
http://www.cmscanbesimple.org/blog/admi ... tification
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
Migrating Company Directory module to LISE
- + - + - + - + - + - + -