}
$timelimit = '';
- if (!((isadmin() and !empty($CFG->admineditalways)) || isteacher($courseid))) {
+ if (!empty($CFG->forum_enabletimedposts) && (!((isadmin() and !empty($CFG->admineditalways)) || isteacher($courseid)))) {
$now = time();
$timelimit = " AND (d.userid = $USER->id OR ((d.timestart = 0 OR d.timestart <= $now) AND (d.timeend = 0 OR d.timeend > $now)))";
}
<?php } ?>
-<?php if ($forum->type == 'news' && !$post->parent) { // This is the first post of a discussion in news forum ?>
-
+<?php if (!empty($CFG->forum_enabletimedposts) &&
+ isteacher($course->id) && $forum->type == 'news' && !$post->parent) {
+ // This is the first post of a discussion in news forum
+ ?>
<tr valign="top">
<td align="right"><b><?php print_string("displayperiod", "forum") ?>:<br />(<?php print_string("optional") ?>) </b></td>
<td>
</td>
</tr>
-<?php } ?>
-
-
+<?php } else { ?>
+<input type="hidden" name="timestartdisabled" value="1" />
+<input type="hidden" name="timeenddisabled" value="1" />
+<? } ?>
<tr>
<td align="center" colspan="2">
<input type="hidden" name="course" value="<?php p($post->course) ?>" />