Customizing SMF > Tips and Tricks

Membergroup Request Approval/Rejection Notifications by PM

(1/1)

GL700Wing:
By default membergroup request approval/rejection notifications are only sent by email.

The following code changes will send the notification by PM (which is handy if the member no longer has access to the account for their forum email address) and, if the recipient does not receive email notifications of PMs, they will also receive the notification by email.

In ./Sources/Groups.php

Find:

--- Code: ---mem.additional_groups AS additional_groups, mem.lngfile, mem.member_name, mem.notify_types, mem.pm_email_notify,
--- End code ---
Add After:

--- Code: --- mem.pm_email_notify,
--- End code ---

Find:

--- Code: --- 'language' => $row['lngfile'],
--- End code ---
Add After:

--- Code: --- 'pm_email_notify' => $row['pm_email_notify'],
--- End code ---

Find:

--- Code: --- $emaildata = loadEmailTemplate('mc_group_approve', $replacements, $email['language']);

sendmail($email['email'], $emaildata['subject'], $emaildata['body'], null, null, false, 2);
--- End code ---
Replace With:

--- Code: --- $emaildata = loadEmailTemplate('mc_group_approve', $replacements, $email['language']);

// Send the notification by PM.
sendpm(array('to' => array($email['member_id']), 'bcc' => array()), $emaildata['subject'], $emaildata['body']);

// If the member does not receive email notifications of PMs send them an email message.
if ($email['pm_email_notify'] == 0)
sendmail($email['email'], $emaildata['subject'], $emaildata['body'], null, null, false, 2);
--- End code ---

Find:

--- Code: --- $emaildata = loadEmailTemplate(empty($custom_reason) ? 'mc_group_reject' : 'mc_group_reject_reason', $replacements, $email['language']);

sendmail($email['email'], $emaildata['subject'], $emaildata['body'], null, null, false, 2);
--- End code ---
Replace With:

--- Code: --- $emaildata = loadEmailTemplate(empty($custom_reason) ? 'mc_group_reject' : 'mc_group_reject_reason', $replacements, $email['language']);

// Send the notification by PM.
sendpm(array('to' => array($email['member_id']), 'bcc' => array()), $emaildata['subject'], $emaildata['body']);

// If the member does not receive email notifications of PMs send them an email message.
if ($email['pm_email_notify'] == 0)
sendmail($email['email'], $emaildata['subject'], $emaildata['body'], null, null, false, 2);
--- End code ---

Navigation

[0] Message Index

Go to full version