if ($teacher = get_record('user_teachers', 'userid', $userid, 'course', $courseid)) {
if ($teacher->editall == $editall) { // Already exists
- return true;
+ return true;
} else { // Just change field
set_field('user_teachers', 'editall', $editall, 'id', $teacher->id);
- return true;
+ return true;
}
}
/// messagehtml - complete html version of the message (optional)
/// attachment - a file on the filesystem, relative to $CFG->dataroot
/// attachname - the name of the file (extension indicates MIME)
-/// usetrueaddress - determines whether $from email address should be sent out.
+/// usetrueaddress - determines whether $from email address should be sent out.
/// Will be overruled by user profile setting for maildisplay
global $CFG, $_SERVER;
$mail->Sender = "$adminuser->email";
- if ($usetrueaddress and $from->maildisplay) {
+ if (is_string($from)) { // So we can pass whatever we want if there is need
+ $mail->From = $CFG->noreplyaddress;
+ $mail->FromName = $from.' '.get_string('noreply', 'forum');
+ } else if ($usetrueaddress and $from->maildisplay) {
$mail->From = "$from->email";
$mail->FromName = fullname($from);
} else {
function clean_filename($string) {
/// Cleans a given filename by removing suspicious or troublesome characters
/// Only these are allowed:
-/// alphanumeric _ - .
+/// alphanumeric _ - .
$string = eregi_replace("\.\.+", "", $string);
$string = preg_replace('/[^\.a-zA-Z\d\_-]/','_', $string ); // only allowed chars
////using scaleid in a courseid
global $CFG;
-
+
$return = 0;
if (!empty($scaleid)) {
}
function site_scale_used($scaleid) {
-////This function returns the nummber of activities
+////This function returns the nummber of activities
////using scaleid in the entire site
global $CFG;
$posthtml .= '<hr size="1" noshade="noshade" /></p>';
}
- if (! email_to_user($userto, $userfrom, $postsubject, $posttext, $posthtml, '', '', $CFG->forum_replytouser)) {
+ if (! email_to_user($userto, $site->shortname, $postsubject, $posttext, $posthtml, '', '', $CFG->forum_replytouser)) {
echo "ERROR!\n";
echo "Error: mod/forum/cron.php: Could not send out digest mail to user $userto->id ($userto->email)... not trying again.\n";
add_to_log($course->id, 'forum', 'mail digest error', '', '', $cm->id, $userto->id);