]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-13936 indicate that user needs group membership to add new discussion, but only...
authorskodak <skodak>
Fri, 18 Apr 2008 19:30:19 +0000 (19:30 +0000)
committerskodak <skodak>
Fri, 18 Apr 2008 19:30:19 +0000 (19:30 +0000)
lang/en_utf8/forum.php
mod/forum/lib.php

index 14657532b08e02ccbdd3d93cafba8ace019dbfe4..a842dabfcc45a61868f99b8f91008d4040eae42a 100644 (file)
@@ -28,7 +28,7 @@ $string['blockperioddisabled'] = 'Don\'t block';
 $string['bynameondate'] = 'by $a->name - $a->date';
 $string['cannotviewpostyet'] = 'You cannot read other students questions in this discussion yet because you haven\'t posted';
 $string['cannotadddiscussion'] = 'Adding discussions to this forum requires group membership.';
-$stirng['cannotdeleteforummudule'] = 'You can not delete the forum module!!';
+$string['cannotadddiscussionall'] = 'Can not add discussions for all participants to this forum.';
 $string['cleanreadtime'] = 'Mark old posts as read hour';
 $string['configcleanreadtime'] = 'The hour of the day to clean old posts from the \'read\' table.';
 $string['configdisplaymode'] = 'The default display mode for discussions if one isn\'t set.';
index d5b2158f9e048a9ffe2ced997e228ccafbfabd51..9688618238d7a83060c7334bfe347b30803b28df 100644 (file)
@@ -4519,8 +4519,17 @@ function forum_print_latest_discussions($course, $forum, $maxdiscussions=-1, $di
         echo '</div>';
         echo '</form>';
         echo "</div>\n";
-    } else if (!isguestuser() and isloggedin() and $forum->type != 'news' and $groupmode == SEPARATEGROUPS and !groups_is_member($currentgroup)) {
-        notify(get_string('cannotadddiscussion', 'forum'));
+
+    } else if (isguestuser() or !isloggedin() or $forum->type == 'news') {
+        // no button and no info
+
+    } else if ($groupmode and has_capability('mod/forum:startdiscussion', $context)) {
+        // inform users why they can not post new discussion
+        if ($currentgroup) {
+            notify(get_string('cannotadddiscussion', 'forum'));
+        } else {
+            notify(get_string('cannotadddiscussionall', 'forum'));
+        }
     }
 
 // Get all the recent discussions we're allowed to see