Advertisement:

Author Topic: Membergroup Request Approval/Rejection Notifications by PM  (Read 77 times)

Offline GL700Wing

  • Full Member
  • ***
  • Posts: 655
  • Gender: Female
Membergroup Request Approval/Rejection Notifications by PM
« on: February 17, 2021, 04:32:35 AM »
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: [Select]
mem.additional_groups AS additional_groups, mem.lngfile, mem.member_name, mem.notify_types, mem.pm_email_notify,Add After:
Code: [Select]
mem.pm_email_notify,
Find:
Code: [Select]
'language' => $row['lngfile'],Add After:
Code: [Select]
'pm_email_notify' => $row['pm_email_notify'],
Find:
Code: [Select]
$emaildata = loadEmailTemplate('mc_group_approve', $replacements, $email['language']);

sendmail($email['email'], $emaildata['subject'], $emaildata['body'], null, null, false, 2);
Replace With:
Code: [Select]
$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:
Code: [Select]
$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:
Code: [Select]
$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 ...