MDL-24951 mod_forum: Check user capability to know what message to show.
If the user has the following capabilty: mod/forum:canposttomygroups then show them the more technical of the strings. Otherwise we use something a bit easier for them to ask their tutor or teacher about.
This commit is contained in:
@@ -53,6 +53,7 @@ $string['bynameondate'] = 'by {$a->name} - {$a->date}';
|
||||
$string['cannotadd'] = 'Could not add the discussion for this forum';
|
||||
$string['cannotadddiscussion'] = 'Adding discussions to this forum requires group membership.';
|
||||
$string['cannotadddiscussionall'] = 'You do not have permission to add a new discussion topic for all participants.';
|
||||
$string['cannotadddiscussiongroup'] = 'You are not able to create a discussion because you are not a member of any group.';
|
||||
$string['cannotaddsubscriber'] = 'Could not add subscriber with id {$a} to this forum!';
|
||||
$string['cannotaddteacherforumto'] = 'Could not add converted teacher forum instance to section 0 in the course';
|
||||
$string['cannotcreatediscussion'] = 'Could not create new discussion';
|
||||
|
||||
+5
-1
@@ -5528,7 +5528,11 @@ function forum_print_latest_discussions($course, $forum, $maxdiscussions = -1, $
|
||||
} else if ($groupmode and !has_capability('moodle/site:accessallgroups', $context)) {
|
||||
// inform users why they can not post new discussion
|
||||
if (!$currentgroup) {
|
||||
echo $OUTPUT->notification(get_string('cannotadddiscussionall', 'forum'));
|
||||
if (!has_capability('mod/forum:canposttomygroups', $context)) {
|
||||
echo $OUTPUT->notification(get_string('cannotadddiscussiongroup', 'forum'));
|
||||
} else {
|
||||
echo $OUTPUT->notification(get_string('cannotadddiscussionall', 'forum'));
|
||||
}
|
||||
} else if (!groups_is_member($currentgroup)) {
|
||||
echo $OUTPUT->notification(get_string('cannotadddiscussion', 'forum'));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user