From: skodak Date: Fri, 18 Apr 2008 19:30:19 +0000 (+0000) Subject: MDL-13936 indicate that user needs group membership to add new discussion, but only... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=d0e422c45aeeff402c60a5ee9461c326c3bf9d0b;p=moodle.git MDL-13936 indicate that user needs group membership to add new discussion, but only if having the capability to add new discussion - previously the message was incorrectly shown even when not having the cap in separate mode, visible mode needs this message too after previous commit; new lang string added in case user selects all participants in group selector and does not have accessallgroups - the existing group membership string could not be reused; merged from MOODLE_19_STABLE --- diff --git a/lang/en_utf8/forum.php b/lang/en_utf8/forum.php index 14657532b0..a842dabfcc 100644 --- a/lang/en_utf8/forum.php +++ b/lang/en_utf8/forum.php @@ -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.'; diff --git a/mod/forum/lib.php b/mod/forum/lib.php index d5b2158f9e..9688618238 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -4519,8 +4519,17 @@ function forum_print_latest_discussions($course, $forum, $maxdiscussions=-1, $di echo ''; echo ''; echo "\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