Skip to content

Commit

Permalink
MDL-30948 stop messaging suspended and deleted users
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak authored and stronk7 committed Jan 3, 2012
1 parent 9e3f885 commit 3b70790
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/messagelib.php
Expand Up @@ -64,6 +64,9 @@ function message_send($eventdata) {
if (is_int($eventdata->userfrom)) { if (is_int($eventdata->userfrom)) {
$eventdata->userfrom = $DB->get_record('user', array('id' => $eventdata->userfrom)); $eventdata->userfrom = $DB->get_record('user', array('id' => $eventdata->userfrom));
} }
if (!isset($eventdata->userto->auth) or !isset($eventdata->userto->suspended) or !isset($eventdata->userto->deleted)) {
$eventdata->userto = $DB->get_record('user', array('id' => $eventdata->userto->id));
}


//after how long inactive should the user be considered logged off? //after how long inactive should the user be considered logged off?
if (isset($CFG->block_online_users_timetosee)) { if (isset($CFG->block_online_users_timetosee)) {
Expand Down
2 changes: 1 addition & 1 deletion lib/moodlelib.php
Expand Up @@ -4620,7 +4620,7 @@ function email_to_user($user, $from, $subject, $messagetext, $messagehtml='', $a
} }


// skip mail to suspended users // skip mail to suspended users
if (isset($user->auth) && $user->auth=='nologin') { if ((isset($user->auth) && $user->auth=='nologin') or (isset($user->suspended) && $user->suspended)) {
return true; return true;
} }


Expand Down
5 changes: 5 additions & 0 deletions message/output/email/message_output_email.php
Expand Up @@ -46,6 +46,11 @@ function send_message($eventdata) {
return true; return true;
} }


// skip any messaging suspended and deleted users
if ($eventdata->userto->auth === 'nologin' or $eventdata->userto->suspended or $eventdata->userto->deleted) {
return true;
}

//the user the email is going to //the user the email is going to
$recipient = null; $recipient = null;


Expand Down
5 changes: 5 additions & 0 deletions message/output/jabber/message_output_jabber.php
Expand Up @@ -50,6 +50,11 @@ function send_message($eventdata){
return true; return true;
} }


// skip any messaging suspended and deleted users
if ($eventdata->userto->auth === 'nologin' or $eventdata->userto->suspended or $eventdata->userto->deleted) {
return true;
}

//hold onto jabber id preference because /admin/cron.php sends a lot of messages at once //hold onto jabber id preference because /admin/cron.php sends a lot of messages at once
static $jabberaddresses = array(); static $jabberaddresses = array();


Expand Down

0 comments on commit 3b70790

Please sign in to comment.