Membergroup Request Approval/Rejection Notifications by PM

Started by GL700Wing, February 17, 2021, 04:32:35 AM

Previous topic - Next topic

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:
mem.additional_groups AS additional_groups, mem.lngfile, mem.member_name, mem.notify_types, mem.pm_email_notify,
Add After:
mem.pm_email_notify,

Find:
'language' => $row['lngfile'],
Add After:
'pm_email_notify' => $row['pm_email_notify'],

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

sendmail($email['email'], $emaildata['subject'], $emaildata['body'], null, null, false, 2);

Replace With:
$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);


Find:
$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);

Replace With:
$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);
Life doesn't have to be perfect to be wonderful ...

Advertisement: