MDL-18440 email_to_user() - avoid some notices ; merged from 19_STABLE
This commit is contained in:
@@ -2336,6 +2336,11 @@ function over_bounce_threshold($user) {
|
||||
if (empty($CFG->handlebounces)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (empty($user->id)) { /// No real (DB) user, nothing to do here.
|
||||
return false;
|
||||
}
|
||||
|
||||
// set sensible defaults
|
||||
if (empty($CFG->minbounces)) {
|
||||
$CFG->minbounces = 10;
|
||||
@@ -2361,6 +2366,10 @@ function over_bounce_threshold($user) {
|
||||
function set_send_count($user,$reset=false) {
|
||||
global $DB;
|
||||
|
||||
if (empty($user->id)) { /// No real (DB) user, nothing to do here.
|
||||
return;
|
||||
}
|
||||
|
||||
if ($pref = $DB->get_record('user_preferences', array('userid'=>$user->id, 'name'=>'email_send_count'))) {
|
||||
$pref->value = (!empty($reset)) ? 0 : $pref->value+1;
|
||||
$DB->update_record('user_preferences', $pref);
|
||||
|
||||
Reference in New Issue
Block a user