Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Topic started by: GL700Wing on September 23, 2019, 09:37:09 PM

Title: Email to Admin on account reactivation after email change
Post by: GL700Wing on September 23, 2019, 09:37:09 PM
By default, and if the option 'Require reactivation after email change' is enabled, the email message that is sent to admins when a member reactivates their account is the same as for when a new member joins which can be a bit confusing ...

The following tip adds the option of notifying admins when an account is reactivated and sends a different email message if the option is enabled.

In ./Sources/Register.php
Find:
SELECT id_member, validation_code, member_name, real_name, email_address, is_activated, passwd, lngfile
Replace With:
SELECT id_member, validation_code, member_name, real_name, email_address, is_activated, passwd, lngfile, last_login

Find:
adminNotify('activation', $row['id_member'], $row['member_name']);
Replace With:
if (empty($row['last_login']))
adminNotify('activation', $row['id_member'], $row['member_name']);
elseif (isset($modSettings['notify_admin_onReactivation']) && !empty($modSettings['notify_admin_onReactivation']))
adminNotify('reactivate', $row['id_member'], $row['member_name']);


In ./Sources/Subs-Post.php
Find:
$emailtype .= '_approval';
}

Add After:

if ($type == 'reactivate')
$emailtype .= '_reactivate';


In ./Themes/default/languages/EmailTemplates.english.php
Find:
{APPROVALLINK}

{REGARDS}',
),

Add After:
'admin_notify_reactivate' => array(
/*
@additional_params: admin_notify
USERNAME:
PROFILELINK:
@description:
*/
'subject' => 'A member has reactivated their account',
'body' => 'The member {USERNAME} has reactivated their account after changing their email address. Click the link below to view their profile.
{PROFILELINK}

{REGARDS}',
),


In ./Themes/default/languages/ManageSettings.english.php
Find:
$txt['send_validation_onChange'] = 'Require reactivation after email change';
Add After:
$txt['notify_admin_onReactivation'] = 'Notify admin on reactivation after email change';

In ./Sources/ManageSettings.php
Find:
array('check', 'send_validation_onChange'),
Add After:
array('check', 'notify_admin_onReactivation'),
Title: Re: Email to Admin on account reactivation after email change
Post by: Aleksi "Lex" Kilpinen on September 24, 2019, 12:20:21 AM
Approved, thank you - not a bad tip :)
Title: Re: Email to Admin on account reactivation after email change
Post by: Antechinus on September 24, 2019, 01:09:16 AM
Nice. Should probably be default.
Title: Re: Email to Admin on account reactivation after email change
Post by: shadav on September 24, 2019, 09:25:00 AM
thank you :) hadn't run into this yet but now I don't have to worry about it :D