#3087 - Banned members still receiving email notifications
| Identifier | #3087 |
|---|---|
| Issue type | Minor issue (breaks specific functionality) |
| Title | Banned members still receiving email notifications |
| Status | Completed |
| Handling member | Chris Graham |
| Addon | core_notifications |
| Description | Banned members on lovinity.org are still receiving email notifications. I do not feel this should be the case (I have a banned member complaining about it). The quick work around is for me to remove the email address of banned members, but that opens up the possibility of banned members registering new accounts under that same email. |
| Steps to reproduce | |
| Funded? | No |
The system will post a comment when this issue is modified (e.g., status changes). To be notified of this, click "Enable comment notifications".


Comments
FIND (in function mail_wrap):
if (@$GLOBALS['SITE_INFO']['no_email_output'] === '1') {
return null;
}
AFTER, ADD:
if ($priority != 1)
{
foreach ($to_email as $key => $email)
{
if ($GLOBALS['FORUM_DRIVER']->is_banned($GLOBALS['FORUM_DRIVER']->get_member_from_email_address($email))) {
unset($to_email[$key]);
}
}
}
The goal of this is to remove the email addresses of all members who have been marked as banned UNLESS mail priority is 1 (critical/urgent). The reason for this priority bypass is because without it, members will not get notifications of private topics telling them that they were banned (I'll be hacking the warnings module to make private topics generated by warnings to have priority 1).
sources/cns_topics_action2.php
FIND (in function send_pt_notification):
if (is_null($post_comcode)) {
$post_comcode = get_translated_text($GLOBALS['FORUM_DB']->query_select_value('f_posts', 'p_post', array('id' => $post_id)), $GLOBALS['FORUM_DB']);
}
AFTER, ADD:
$emphasised = ($GLOBALS['SITE_DB']->query_select_value('f_posts', 'p_is_emphasised', array('id' => $post_id)) == 1);
FIND:
dispatch_notification('cns_new_pt', null, $msubject, $mmessage, array($to_id), $from_id);
CHANGE TO:
dispatch_notification('cns_new_pt', null, $msubject, $mmessage, array($to_id), $from_id, ($emphasised) ? 1 : 3);
Will let you know how the hack goes.
if ($priority != 1 && !is_null($to_email))
{
foreach ($to_email as $key => $email)
{
if ($GLOBALS['FORUM_DRIVER']->is_banned($GLOBALS['FORUM_DRIVER']->get_member_from_email_address($email))) {
unset($to_email[$key]);
}
if (is_null($to_email) || count($to_email) == 0)
return null;
}
}
I've made only a couple of changes:
1) I've improved get_member_from_email_address to prioritise non-banned and newer accounts (in case a duplicate account was banned)
2) I have disabled starting PTs and using contact-member in the UI to a banned member (nobody should do that as logging in to see the PTs won't be possible - it should be taken off the site via direct e-mail)
1. A user breaks the rules and earns a ban.
2. The user is set not to receive email notifications for private topics.
3. A staff member uses the warnings system to send them a PT informing them of their ban, and issues the ban.
4. The user is banned, but doesn't know about it and doesn't know why because a) no email was sent, and b) they cannot log in to view their warning PT.