$string['forcesubscribe'] = 'Force everyone to be subscribed';
$string['forcesubscribeq'] = 'Force everyone to be subscribed?';
$string['forum'] = 'Forum';
+$string['forum:addnews'] = 'Add news';
$string['forum:createattachment'] = 'Create attachments';
$string['forum:deleteanypost'] = 'Delete any posts (anytime)';
$string['forum:deleteownpost'] = 'Delete own posts (within deadline)';
$string['forum:throttlingapplies'] = 'Throttling applies';
$string['forum:rate'] = 'Rate posts';
$string['forum:replypost'] = 'Reply to posts';
+$string['forum:replynews'] = 'Reply to news';
$string['forum:splitdiscussions'] = 'Split discussions';
$string['forum:startdiscussion'] = 'Start new discussions';
$string['forum:viewanyrating'] = 'View any ratings';
)
),
+ 'mod/forum:addnews' => array(
+
+ 'riskbitmask' => RISK_SPAM,
+
+ 'captype' => 'write',
+ 'contextlevel' => CONTEXT_MODULE,
+ 'legacy' => array(
+ 'teacher' => CAP_ALLOW,
+ 'editingteacher' => CAP_ALLOW,
+ 'admin' => CAP_ALLOW
+ )
+ ),
+
+ 'mod/forum:replynews' => array(
+
+ 'riskbitmask' => RISK_SPAM,
+
+ 'captype' => 'write',
+ 'contextlevel' => CONTEXT_MODULE,
+ 'legacy' => array(
+ 'teacher' => CAP_ALLOW,
+ 'editingteacher' => CAP_ALLOW,
+ 'admin' => CAP_ALLOW
+ )
+ ),
+
'mod/forum:viewrating' => array(
'captype' => 'read',
(ismember($discussion->groupid) || $mygroupid == $discussion->groupid) );
}
} else {
- if (!has_capability('mod/forum:replypost', $modcontext)) {
+ if ($forum->type == 'news') {
+ $capname = 'mod/forum:replynews';
+ } else {
+ $capname = 'mod/forum:replypost';
+ }
+
+ if (!has_capability($capname, $modcontext)) {
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
if (!has_capability('moodle/legacy:guest', $coursecontext, NULL, false)) { // User is a guest here!
$canreply = false;
}
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
- if (!has_capability('mod/forum:startdiscussion', $context)) {
+ if ($forum->type == 'news') {
+ $capname = 'mod/forum:addnews';
+ } else {
+ $capname = 'mod/forum:startdiscussion';
+ }
+
+ if (!has_capability($capname, $context)) {
return false;
}
}
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
- if (isset($user)) {
- $canreply = has_capability('mod/forum:replypost', $context, $user->id, false)
+ if ($forum->type == 'news') {
+ $capname = 'mod/forum:replynews';
+ } else {
+ $capname = 'mod/forum:replypost';
+ }
+
+ if (!empty($user)) {
+ $canreply = has_capability($capname, $context, $user->id, false)
&& !has_capability('moodle/legacy:guest', $context, $user->id, false);
} else {
- $canreply = has_capability('mod/forum:replypost', $context, NULL, false)
+ $canreply = has_capability($capname, $context, NULL, false)
&& !has_capability('moodle/legacy:guest', $context, NULL, false);
}
$timemessage = 4;
}
- if ($fromform->mailnow) {
+ if (!empty($fromform->mailnow)) {
$message .= get_string("postmailnow", "forum");
$timemessage = 4;
} else {
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
-$module->version = 2007020200;
-$module->requires = 2007020200; // Requires this Moodle version
+$module->version = 2007020201;
+$module->requires = 2007020201; // Requires this Moodle version
$module->cron = 60;
?>