Permalink
Browse files

MDL-30948 stop messaging suspended and deleted users

  • Loading branch information...
1 parent 9e3f885 commit 3b70790aee2b004d087cf42936633e769429d2b3 @skodak skodak committed with stronk7 Dec 29, 2011
View
@@ -64,6 +64,9 @@ function message_send($eventdata) {
if (is_int($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?
if (isset($CFG->block_online_users_timetosee)) {
View
@@ -4620,7 +4620,7 @@ function email_to_user($user, $from, $subject, $messagetext, $messagehtml='', $a
}
// 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;
}
@@ -46,6 +46,11 @@ function send_message($eventdata) {
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
$recipient = null;
@@ -50,6 +50,11 @@ function send_message($eventdata){
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
static $jabberaddresses = array();

0 comments on commit 3b70790

Please sign in to comment.