global $THEME, $USER, $CFG;
- static $stredit, $strdelete, $strreply, $strparent, $threadedmode, $isteacher;
+ static $stredit, $strdelete, $strreply, $strparent, $threadedmode, $isteacher, $adminedit;
if (empty($stredit)) {
$stredit = get_string("edit", "forum");
$strparent = get_string("parent", "forum");
$threadedmode = (!empty($USER->mode) and ($USER->mode == FORUM_MODE_THREADED));
$isteacher = isteacher($courseid);
+ $adminedit = (isadmin() and !empty($CFG->admineditalways));
}
echo "<a name=\"$post->id\"></a>";
}
$age = time() - $post->created;
- if ($ownpost) {
- if ($age < $CFG->maxeditingtime) {
+ if ($ownpost or $adminedit) {
+ if (($age < $CFG->maxeditingtime) or $adminedit) {
echo "<a href=\"$CFG->wwwroot/mod/forum/post.php?edit=$post->id\">$stredit</a> | ";
}
}
} else if (isset($edit)) { // User is editing their own post
+ $adminedit = (isadmin() and !empty($CFG->admineditalways));
+
if (! $post = forum_get_post_full($edit)) {
error("Post ID was incorrect");
}
- if ($post->userid <> $USER->id) {
+ if (($post->userid <> $USER->id) and !$adminedit) {
error("You can't edit other people's posts!");
}
- if ((time() - $post->created) > $CFG->maxeditingtime) {
+ if (((time() - $post->created) > $CFG->maxeditingtime) and !$adminedit) {
error( get_string("maxtimehaspassed", "forum", format_time($CFG->maxeditingtime)) );
}
if ($post->parent) {