Ok, so once I have amened the MAXEDITINGTIME to be 24hours, 1440 mins, that's 86400 in seconds. Do this buy editing the maxeditingtime field in the
database and setting it to : 86400.
To change the available options in the site settings edit the file
/admin/settings/security.php
Find the code code around line 14 & add some more options:
$temp->add(new admin_setting_configselect('maxeditingtime', get_string('maxeditingtime','admin'), get_string('configmaxeditingtime','admin'), 1800,
array(60 => get_string('numminutes', '', 1),
300 => get_string('numminutes', '', 5),
900 => get_string('numminutes', '', 15),
1800 => get_string('numminutes', '', 30),
2700 => get_string('numminutes', '', 45),
3600 => get_string('numminutes', '', 60),
7200 => get_string('numminutes', '', 120), 10800 => get_string('numminutes', '', 180), 25200 => get_string('numminutes', '', 240), 86400 => get_string('numminutes', '', 1440)))); // <-- 24 hours //finished editing maxeditingtime options.
NEXTFind the file lib.php in /mod/forum/
Forum Customisation to allow for passive forum monitoring. Notifies admins and tutors of new posts before emailed out to subscribed users.
Customisation Sends
Site administrators and
Course Tutors copies of forum posts as they are created.
This allows for posts to be intercepted by a
Forum moderator before copies of the post are sent to
students.
Moderators can edit, delete, ignore or otherwise actively address any points or issues raised by the forum post.
Normal forum behaviour is kept with a few difference ;-
- Adjusted maxeditingtime to 24 hours
System will only send subscribed users emailed copies of posts 24hours after initial creation.
- Site Admins & Course Tutors are emailed immediately any new forum post or replies
- Site Admins can always edit forum posts (regardless of age) using this option in config.php: $CFG->admineditalways = true;
Adjustments to allow replies :Edit the file /mod/forum/lib.phpFind the Line : 2966
Edit the following code :
// Update discussion modified date set_field("forum_discussions", "timemodified", $post->modified, "id", $post->discussion); set_field("forum_discussions", "usermodified", $post->userid, "id", $post->discussion); if (forum_tp_can_track_forums($post->forum) && forum_tp_is_tracked($post->forum)) { forum_tp_mark_post_read($post->userid, $post, $post->forum); }<!!INSERT CODE GOES HERE!!> return $post->id;}INSERT
RED CODE BETWEEN CODE IN
GREEN :
forum_tp_mark_post_read($post->userid, $post, $post->forum); }// Steve inserted code here EMAIL ADMIN/TUTORS WHEN FORUMS ARE REPLIED TO
//========================================================================================================
//STEVE UPDATE 2nd APRIL 2009 // EMAIL ADMIN/TUTORS WHEN FORUMS ARE REPLIED TO
$to = array();
$tostr = '';
//get teachers emails and append to address
$context = get_context_instance(CONTEXT_COURSE, $post->course);
$rusers = get_role_users(3, $context);
if (!empty($rusers))
{
foreach ($rusers as $teacher)
$to[]= trim($teacher->email);
}
//get site admin emails and append to address
$scontext = get_context_instance(CONTEXT_SYSTEM);
$susers = get_role_users(1, $scontext);
if (!empty($susers))
{
foreach ($susers as $admin)
$to[]= trim($admin->email);
}
$to2 = array_unique($to);
if (!empty($to2))
{
foreach ($to2 as $em)
{
$tostr .= $em.',';
}
}
$tostr = substr($tostr,0,-1);
//create mail subject
$postsubject = stripslashes("ALERT! New Reply: ".$post->subject);
//create mail body
// $body_str = $post->message;
//$body_str = trusttext_strip($body_str);
// $body_str = substr_replace($body_str,"<br/>","\r\n");
//$body_str = strip_tags($body_str);
$body_str = stripslashes(format_text_email(trusttext_strip($post->message),'text'));
$postbody = 'New Post ('.$post->subject.') by '.$USER->firstname.' '.$USER->lastname."\r\n\r\n";
$postbody .= '---------------------------------------------------'."\r\n";
$postbody .= $body_str."\r\n"."\r\n";
$postbody .= 'Created: '.date('d/M/y H:ia',$post->created)."\r\n";
$postbody .= "\r\n";
$postbody .= $CFG->wwwroot.'/mod/forum/discuss.php?d='.$post->discussion.'#p'.$post->parent.''."\r\n";
//create email headers
$headers = "From: ".$USER->firstname." ".$USER->lastname."<".$USER->email.">\r\n";
$mailresult = mail($tostr,$postsubject,$postbody,$headers);
if (!$mailresult)
error ("Reply Mail fail..."); //========================================================================================================
//end steve forum reply code return $post->id;
}
Adjustments to allow for Forum Updates (if updated within the 24hour maxeditingtime period):EDIT around line: 3062
INSERT
RED CODE BETWEEN CODE IN
GREEN :
if (forum_tp_can_track_forums($post->forum) && forum_tp_is_tracked($post->forum)) { forum_tp_mark_post_read($post->userid, $post, $post->forum); }// Steve inserted code here EMAIL ADMIN/TUTORS WHEN FORUM POSTS ARE UPDATED WITHIN 'MAXEDITINGTIME' PERIOD //======================================================================================================== //STEVE EDIT UPDATE 2nd APRIL 2009 // EMAIL ADMIN/TUTORS WHEN FORUM POSTS ARE UPDATED WITHIN 'MAXEDITINGTIME' PERIOD $to = array(); $tostr = ''; //get teachers emails and append to address $context = get_context_instance(CONTEXT_COURSE, $post->course); $rusers = get_role_users(3, $context); if (!empty($rusers)) { foreach ($rusers as $teacher) $to[]= trim($teacher->email); } //get site admin emails and append to address $scontext = get_context_instance(CONTEXT_SYSTEM); $susers = get_role_users(1, $scontext); if (!empty($susers)) { foreach ($susers as $admin) $to[]= trim($admin->email); } $to2 = array_unique($to); if (!empty($to2)) { foreach ($to2 as $em) { $tostr .= $em.','; } } $tostr = substr($tostr,0,-1); //create mail subject $postsubject = stripslashes("ALERT! Post Update: ".$post->subject); //create mail body // $body_str = $post->message; //$body_str = trusttext_strip($body_str); // $body_str = substr_replace($body_str,"<br/>","\r\n"); //$body_str = strip_tags($body_str); $body_str = stripslashes(format_text_email(trusttext_strip($post->message),'text')); $postbody = 'New Post ('.$post->subject.') by '.$USER->firstname.' '.$USER->lastname."\r\n\r\n"; $postbody .= '---------------------------------------------------'."\r\n"; $postbody .= $body_str."\r\n"."\r\n"; $postbody .= 'Created: '.date('d/M/y H:ia',$post->created)."\r\n"; $postbody .= "\r\n"; $postbody .= $CFG->wwwroot.'/mod/forum/discuss.php?d='.$post->discussion.'#p'.$post->parent.''."\r\n"; //create email headers $headers = "From: ".$USER->firstname." ".$USER->lastname."<".$USER->email.">\r\n"; $mailresult = mail($tostr,$postsubject,$postbody,$headers); if (!$mailresult) error ("Update Mail fail..."); //======================================================================================================== //Steve edit - END CODE FOR FORUM POSTS ARE UPDATED WITHIN 'MAXEDITINGTIME' PERIOD return update_record("forum_posts", $post);}Allow for NEW Forum Discussions:EDIT around line: 3186
INSERT
RED CODE BETWEEN CODE IN
GREEN :
if (forum_tp_can_track_forums($post->forum) && forum_tp_is_tracked($post->forum)) { forum_tp_mark_post_read($post->userid, $post, $post->forum); } // SEND EMAIL COPIES OF NEW FORUM DISCUSSIONS TO ADMINS & TUTORS //======================================================================================================== //STEVE EDITED CODE UPDATE 1st APRIL 2009 // SEND EMAIL COPIES OF NEW FORUM DISCUSSIONS TO ADMINS & TUTORS $to = array(); $tostr = ''; //get teachers emails and append to address $context = get_context_instance(CONTEXT_COURSE, $post->course); $rusers = get_role_users(3, $context); if (!empty($rusers)) { foreach ($rusers as $teacher) $to[]= trim($teacher->email); } //get site admin emails and append to address $scontext = get_context_instance(CONTEXT_SYSTEM); $susers = get_role_users(1, $scontext); if (!empty($susers)) { foreach ($susers as $admin) $to[]= trim($admin->email); } $to2 = array_unique($to); if (!empty($to2)) { foreach ($to2 as $em) { $tostr .= $em.','; } } $tostr = substr($tostr,0,-1); //create mail subject $postsubject = stripslashes("ALTERT! New Post: ".$discussion->name); //create mail body // $body_str = $post->message; //$body_str = trusttext_strip($body_str); // $body_str = substr_replace($body_str,"<br/>","\r\n"); //$body_str = strip_tags($body_str); $body_str = stripslashes(format_text_email(trusttext_strip($post->message),'text')); $postbody = 'New Post ('.$discussion->name.') by '.$USER->firstname.' '.$USER->lastname."\r\n\r\n"; $postbody .= '---------------------------------------------------'."\r\n"; $postbody .= $body_str."\r\n"."\r\n"; $postbody .= 'Created: '.date('d/M/y H:ia',$post->created)."\r\n"; $postbody .= "\r\n"; $postbody .= $CFG->wwwroot.'/mod/forum/discuss.php?d='.$post->discussion.''."\r\n"; //create email headers $headers = "From: ".$USER->firstname." ".$USER->lastname."<".$USER->email.">\r\n"; $mailresult = mail($tostr,$postsubject,$postbody,$headers); if (!$mailresult) error ("Discussion Mail fail..."); //======================================================================================================== //end code 26th March updated 1st April by Steve return $post->discussion;}DONEI hope this helps someone else out.
Otherwise wait forr moodle 2.0 as moderation is going to be built in I belive.
The above method will work or 1.8 & 1.9 moodles
Steve
www.sheilds-elearning.co.uk