/// If so, make sure the current person is allowed to see this discussion
/// Also, if we know they should be able to reply, then explicitly set $canreply
- $canreply = NULL; /// No override one way or the other
+ $canreply = true; /// By default, because guests etc will be asked to log in
$groupmode = groupmode($course, $cm);
} else if ($groupmode == VISIBLEGROUPS) {
$canreply = ( (empty($mygroupid) && $discussion->groupid == -1) ||
- (ismember($discussion->groupid) || $mygroupid == $discussion->groupid) &&
- has_capability('mod/forum:replypost', $modcontext) );
+ (ismember($discussion->groupid) || $mygroupid == $discussion->groupid) );
}
}
$name = optional_param('name','',PARAM_CLEAN);
$confirm = optional_param('confirm',0,PARAM_INT);
+ $sitecontext = get_context_instance(CONTEXT_SYSTEM);
+
+ if (has_capability('moodle/legacy:guest', $sitecontext, NULL, false)) {
- if (isguest()) {
$wwwroot = $CFG->wwwroot.'/login/index.php';
if (!empty($CFG->loginhttps)) {
$wwwroot = str_replace('http','https', $wwwroot);
}
- if (isset($forum)) { // User is starting a new discussion in a forum
+ if (!empty($forum)) { // User is starting a new discussion in a forum
if (! $forum = get_record('forum', 'id', $forum)) {
error('The forum number was incorrect');
}