From db8312d23c048e89c35c15e7abc9f3af49b55538 Mon Sep 17 00:00:00 2001 From: Rossiani Wijaya Date: Tue, 22 Nov 2011 15:26:44 +0800 Subject: [PATCH] MDL-27735 Q&A forum: add new caps to add question. By default, teacher, editing teacher and manager role has the capability to add new question --- mod/forum/db/access.php | 12 ++++++++++++ mod/forum/lang/en/forum.php | 1 + mod/forum/lib.php | 2 ++ mod/forum/version.php | 2 +- 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/mod/forum/db/access.php b/mod/forum/db/access.php index 58583c3f758..d88fe52d5cd 100644 --- a/mod/forum/db/access.php +++ b/mod/forum/db/access.php @@ -333,5 +333,17 @@ $capabilities = array( 'student' => CAP_ALLOW, ) ), + 'mod/forum:addquestion' => array( + + 'riskbitmask' => RISK_SPAM, + + 'captype' => 'write', + 'contextlevel' => CONTEXT_MODULE, + 'archetypes' => array( + 'teacher' => CAP_ALLOW, + 'editingteacher' => CAP_ALLOW, + 'manager' => CAP_ALLOW + ) + ), ); diff --git a/mod/forum/lang/en/forum.php b/mod/forum/lang/en/forum.php index 6ab1c50c3f7..19da7f901bb 100644 --- a/mod/forum/lang/en/forum.php +++ b/mod/forum/lang/en/forum.php @@ -149,6 +149,7 @@ $string['exportdiscussion'] = 'Export whole discussion'; $string['forcessubscribe'] = 'This forum forces everyone to be subscribed'; $string['forum'] = 'Forum'; $string['forum:addnews'] = 'Add news'; +$string['forum:addquestion'] = 'Add question'; $string['forumauthorhidden'] = 'Author (hidden)'; $string['forumblockingalmosttoomanyposts'] = 'You are approaching the posting threshold. You have posted {$a->numposts} times in the last {$a->blockperiod} and the limit is {$a->blockafter} posts.'; $string['forumbodyhidden'] = 'This post cannot be viewed by you, probably because you have not posted in the discussion or the maximum editing time hasn\'t passed yet.'; diff --git a/mod/forum/lib.php b/mod/forum/lib.php index 4a0e2f7dacf..48344e405cb 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -4824,6 +4824,8 @@ function forum_user_can_post_discussion($forum, $currentgroup=null, $unused=-1, if ($forum->type == 'news') { $capname = 'mod/forum:addnews'; + } else if ($forum->type == 'qanda') { + $capname = 'mod/forum:addquestion'; } else { $capname = 'mod/forum:startdiscussion'; } diff --git a/mod/forum/version.php b/mod/forum/version.php index 06d11fa2fb1..8ebae3660ec 100644 --- a/mod/forum/version.php +++ b/mod/forum/version.php @@ -26,7 +26,7 @@ defined('MOODLE_INTERNAL') || die(); -$module->version = 2011110600; +$module->version = 2011110601; $module->requires = 2011110200; // Requires this Moodle version $module->cron = 60; $module->component = 'mod_forum'; \ No newline at end of file -- 2.43.0