Permalink
Browse files

Fixes for MDL-7461. Removed checks for legacy guest capability as wel…

…l (redundant).
  • Loading branch information...
1 parent 3b0b90d commit e2e91ea8ce3f18364c5c57209cae5c6af49d6e78 vyshane committed Nov 13, 2006
Showing with 5 additions and 17 deletions.
  1. +3 −15 mod/forum/lib.php
  2. +2 −2 mod/forum/post.php
View
@@ -1833,11 +1833,6 @@ function forum_make_mail_post(&$post, $user, $touser, $course,
$post->discussion.'&amp;parent='.$post->parent.'">'.get_string('parent', 'forum').'</a>';
}
- if ($ownpost) {
- $commands[] = '<a target="_blank" href="'.$CFG->wwwroot.'/mod/forum/post.php?delete='.$post->id.'">'.
- get_string('delete', 'forum').'</a>';
- }
-
if ($reply) {
$commands[] = '<a target="_blank" href="'.$CFG->wwwroot.'/mod/forum/post.php?reply='.$post->id.'">'.
get_string('reply', 'forum').'</a>';
@@ -2942,10 +2937,6 @@ function forum_user_can_post_discussion($forum, $currentgroup=false, $groupmode=
return false;
}
- if (has_capability('moodle/legacy:guest', $context, NULL, false)) { // User is a guest here!
- return false;
- }
-
if ($forum->type == "eachuser") {
return (!forum_user_has_posted_discussion($forum->id, $USER->id));
} else if ($currentgroup) {
@@ -2977,11 +2968,9 @@ function forum_user_can_post($forum, $user=NULL) {
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
if (isset($user)) {
- $canreply = has_capability('mod/forum:replypost', $context, $user->id, false) &&
- !has_capability('moodle/legacy:guest', $context, $user->id, false);
+ $canreply = has_capability('mod/forum:replypost', $context, $user->id, false);
} else {
- $canreply = has_capability('mod/forum:replypost', $context, NULL, false) &&
- !has_capability('moodle/legacy:guest', $context, NULL, false);
+ $canreply = has_capability('mod/forum:replypost', $context, NULL, false);
}
return $canreply;
@@ -3153,8 +3142,7 @@ function forum_print_latest_discussions($course, $forum, $maxdiscussions=5, $dis
/// If the user can post discussions, then this is a good place to put the button for it
//add group mode in there, to test for visible group
- if (forum_user_can_post_discussion($forum, $currentgroup, $groupmode) ||
- has_capability('moodle/legacy:guest', $context, NULL, false)) {
+ if (forum_user_can_post_discussion($forum, $currentgroup, $groupmode)) {
echo '<div class="singlebutton forumaddnew">';
echo "<form name=\"newdiscussionform\" method=\"get\" action=\"$CFG->wwwroot/mod/forum/post.php\">";
View
@@ -399,7 +399,7 @@
if (groupmode($course, $cm)) { // Make sure user can post here
$mygroupid = mygroupid($course->id);
if (!((empty($mygroupid) and $discussion->groupid == -1) || (ismember($discussion->groupid)/*$mygroupid == $discussion->groupid*/))) {
- error("Sorry, but you can not post in this discussion.");
+ print_error('nopostdiscussion', 'forum');
}
}
if (!$cm->visible and !has_capability('moodle/course:manageactivities', $coursecontext)) {
@@ -810,4 +810,4 @@
print_footer($course);
-?>
+?>

0 comments on commit e2e91ea

Please sign in to comment.