diff --git a/mod/forum/classes/post_form.php b/mod/forum/classes/post_form.php index 0fbe196b472..520a2ecff3a 100644 --- a/mod/forum/classes/post_form.php +++ b/mod/forum/classes/post_form.php @@ -147,23 +147,6 @@ class mod_forum_post_form extends moodleform { $mform->addElement('checkbox', 'mailnow', get_string('mailnow', 'forum')); } - if (!empty($CFG->forum_enabletimedposts) && !$post->parent && has_capability('mod/forum:viewhiddentimedposts', $coursecontext)) { // hack alert - $mform->addElement('header', 'displayperiod', get_string('displayperiod', 'forum')); - - $mform->addElement('date_time_selector', 'timestart', get_string('displaystart', 'forum'), array('optional' => true)); - $mform->addHelpButton('timestart', 'displaystart', 'forum'); - - $mform->addElement('date_time_selector', 'timeend', get_string('displayend', 'forum'), array('optional' => true)); - $mform->addHelpButton('timeend', 'displayend', 'forum'); - - } else { - $mform->addElement('hidden', 'timestart'); - $mform->setType('timestart', PARAM_INT); - $mform->addElement('hidden', 'timeend'); - $mform->setType('timeend', PARAM_INT); - $mform->setConstants(array('timestart'=> 0, 'timeend'=>0)); - } - if ($groupmode = groups_get_activity_groupmode($cm, $course)) { $groupdata = groups_get_activity_allowed_groups($cm); @@ -237,6 +220,24 @@ class mod_forum_post_form extends moodleform { $mform->addElement('static', 'groupinfo', get_string('group'), $groupname); } } + + if (!empty($CFG->forum_enabletimedposts) && !$post->parent && has_capability('mod/forum:viewhiddentimedposts', $coursecontext)) { + $mform->addElement('header', 'displayperiod', get_string('displayperiod', 'forum')); + + $mform->addElement('date_time_selector', 'timestart', get_string('displaystart', 'forum'), array('optional' => true)); + $mform->addHelpButton('timestart', 'displaystart', 'forum'); + + $mform->addElement('date_time_selector', 'timeend', get_string('displayend', 'forum'), array('optional' => true)); + $mform->addHelpButton('timeend', 'displayend', 'forum'); + + } else { + $mform->addElement('hidden', 'timestart'); + $mform->setType('timestart', PARAM_INT); + $mform->addElement('hidden', 'timeend'); + $mform->setType('timeend', PARAM_INT); + $mform->setConstants(array('timestart' => 0, 'timeend' => 0)); + } + //------------------------------------------------------------------------------- // buttons if (isset($post->edit)) { // hack alert