View Issue Details

IDProjectCategoryView StatusLast Update
3087Composrcore_notificationspublic2017-02-26 21:17
ReporterPDStig Assigned ToChris Graham  
PriorityhighSeverityminor 
Status resolvedResolutionfixed 
Summary3087: Banned members still receiving email notifications
DescriptionBanned 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.
TagsNo tags attached.
Attach Tags
Time estimation (hours)
Sponsorship open

Sponsor

Date Added Member Amount Sponsored

Activities

PDStig

2017-02-18 20:26

administrator   ~4797

Going to test the following implementation in sources/mail.php:

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).

PDStig

2017-02-18 20:58

administrator   ~4798

Not able to hack the warnings system to do the desired operation, but since the warnings system sends posts as emphasised, I did something else.

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.

PDStig

2017-02-18 21:43

administrator   ~4799

Last edited: 2017-02-24 22:43

The code seems to work well, although I did tweak the modification I used in mail.php to this:

    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;
        }
    }

Chris Graham

2017-02-26 19:21

administrator   ~4808

I'll get some kind of workaround as I agree with the core issue, but it would be very simple to workaround without a panic. You could just delete the account, or edit the account to have a different email address.

Guest

2017-02-26 19:34

reporter   ~4809

i.e. if a user is threatening legal action, I can't see any reason to continue to maintain any relationship with that user vis-a-vis an account tied to their email address. Unless it's an extreme situation, like government records.

Chris Graham

2017-02-26 19:54

administrator   ~4810

Your fix is very good. I like the emphasised priority, even without the banned situation it is good.

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)

PDStig

2017-02-26 19:58

administrator   ~4811

Sounds good. For 2, did you ensure this will not clash with the warnings module... eg. the warnings system sends the PT before the ban is registered?

Chris Graham

2017-02-26 19:59

administrator   ~4812

Yeah, it's at the UI level only, i..e the forms to explicitly start these.

PDStig

2017-02-26 20:03

administrator   ~4813

Ouch, I just realised something. Here's a problematic situation:

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.

Chris Graham

2017-02-26 21:17

administrator   ~4816

I'll force the notification to email for banned members.

Issue History

Date Modified Username Field Change
2017-02-17 04:08 PDStig New Issue
2017-02-18 20:26 PDStig Note Added: 0004797
2017-02-18 20:58 PDStig Note Added: 0004798
2017-02-18 21:43 PDStig Note Added: 0004799
2017-02-24 22:43 PDStig Note Edited: 0004799
2017-02-24 22:43 PDStig Note Edited: 0004799
2017-02-26 19:21 Chris Graham Note Added: 0004808
2017-02-26 19:34 Guest Note Added: 0004809
2017-02-26 19:54 Chris Graham Note Added: 0004810
2017-02-26 19:54 Chris Graham Status Not Assigned => Resolved
2017-02-26 19:54 Chris Graham Resolution open => fixed
2017-02-26 19:54 Chris Graham Assigned To => Chris Graham
2017-02-26 19:58 PDStig Note Added: 0004811
2017-02-26 19:59 Chris Graham Note Added: 0004812
2017-02-26 20:03 PDStig Note Added: 0004813
2017-02-26 21:17 Chris Graham Note Added: 0004816