From d4514e46fc1178bbd40f535083b29fcf600e8147 Mon Sep 17 00:00:00 2001 From: Andrew Davis Date: Thu, 26 Aug 2010 07:36:23 +0000 Subject: [PATCH] forum MDL-23388 altered the logic around making users exempt from the forum post threshold --- mod/forum/db/access.php | 5 ++++- mod/forum/lang/en/forum.php | 7 ++++--- mod/forum/lib.php | 6 +++--- mod/forum/version.php | 4 ++-- version.php | 2 +- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/mod/forum/db/access.php b/mod/forum/db/access.php index b9d9d657c20..fc7f81f4ce5 100644 --- a/mod/forum/db/access.php +++ b/mod/forum/db/access.php @@ -294,13 +294,16 @@ $capabilities = array( ) ), - 'mod/forum:throttlingapplies' => array( + 'mod/forum:postwithoutthrottling' => 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 1c6f7817c0a..e3eab06ef79 100644 --- a/mod/forum/lang/en/forum.php +++ b/mod/forum/lang/en/forum.php @@ -49,9 +49,9 @@ $string['attachment_help'] = 'You can optionally attach one or more files to a f $string['attachmentnopost'] = 'You cannot export attachments without a post id'; $string['attachments'] = 'Attachments'; $string['blockafter'] = 'Post threshold for blocking'; -$string['blockafter_help'] = 'This setting specifies the maximum number of posts which a student can post in the given time period. Only applies to users with the capability mod/forum:throttlingapplies.'; +$string['blockafter_help'] = 'This setting specifies the maximum number of posts which a user can post in the given time period. Users with the capability mod/forum:postwithoutthrottling are exempt from post limits.'; $string['blockperiod'] = 'Time period for blocking'; -$string['blockperiod_help'] = 'Students can be blocked from posting more than a given number of posts in a given time period. Only applies to users with the capability mod/forum:throttlingapplies.'; +$string['blockperiod_help'] = 'Students can be blocked from posting more than a given number of posts in a given time period. Users with the capability mod/forum:postwithoutthrottling are exempt from post limits.'; $string['blockperioddisabled'] = 'Don\'t block'; $string['blogforum'] = 'Standard forum displayed in a blog-like format'; $string['bynameondate'] = 'by {$a->name} - {$a->date}'; @@ -167,6 +167,7 @@ $string['forum:initialsubscriptions'] = 'Initial subscription'; $string['forumintro'] = 'Forum introduction'; $string['forum:managesubscriptions'] = 'Manage subscriptions'; $string['forum:movediscussions'] = 'Move discussions'; +$string['forum:postwithoutthrottling'] = 'Exempt from post threshold'; $string['forumname'] = 'Forum name'; $string['forumposts'] = 'Forum posts'; $string['forum:rate'] = 'Rate posts'; @@ -419,7 +420,7 @@ $string['unsubscribeshort'] = 'Unsubscribe'; $string['usermarksread'] = 'Manual message read marking'; $string['viewalldiscussions'] = 'View all discussions'; $string['warnafter'] = 'Post threshold for warning'; -$string['warnafter_help'] = 'Students can be warned as they approach the maximum number of posts allowed in a given period. This setting specifies after how many posts they are warned. Only applies to users with the capability mod/forum:throttlingapplies.'; +$string['warnafter_help'] = 'Students can be warned as they approach the maximum number of posts allowed in a given period. This setting specifies after how many posts they are warned. Users with the capability mod/forum:postwithoutthrottling are exempt from post limits.'; $string['youratedthis'] = 'You rated this'; $string['yournewquestion'] = 'Your new question'; $string['yournewtopic'] = 'Your new discussion topic'; diff --git a/mod/forum/lib.php b/mod/forum/lib.php index 892dc399dfe..3033944e02c 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -6841,7 +6841,7 @@ function forum_check_throttling($forum, $cm=null) { } $modcontext = get_context_instance(CONTEXT_MODULE, $cm->id); - if(!has_capability('mod/forum:throttlingapplies', $modcontext)) { + if(has_capability('mod/forum:postwithoutthrottling', $modcontext)) { return true; } @@ -7171,7 +7171,7 @@ function forum_convert_to_roles($forum, $forummodid, $teacherroles=array(), assign_capability('mod/forum:viewqandawithoutposting', CAP_PREVENT, $studentrole->id, $context->id); assign_capability('mod/forum:viewsubscribers', CAP_PREVENT, $studentrole->id, $context->id); assign_capability('mod/forum:managesubscriptions', CAP_PREVENT, $studentrole->id, $context->id); - assign_capability('mod/forum:throttlingapplies', CAP_PREVENT, $studentrole->id, $context->id); + assign_capability('mod/forum:postwithoutthrottling', CAP_PREVENT, $studentrole->id, $context->id); } foreach ($guestroles as $guestrole) { assign_capability('mod/forum:viewdiscussion', CAP_PREVENT, $guestrole->id, $context->id); @@ -7190,7 +7190,7 @@ function forum_convert_to_roles($forum, $forummodid, $teacherroles=array(), assign_capability('mod/forum:viewqandawithoutposting', CAP_PREVENT, $guestrole->id, $context->id); assign_capability('mod/forum:viewsubscribers', CAP_PREVENT, $guestrole->id, $context->id); assign_capability('mod/forum:managesubscriptions', CAP_PREVENT, $guestrole->id, $context->id); - assign_capability('mod/forum:throttlingapplies', CAP_PREVENT, $guestrole->id, $context->id); + assign_capability('mod/forum:postwithoutthrottling', CAP_PREVENT, $guestrole->id, $context->id); } } } else { diff --git a/mod/forum/version.php b/mod/forum/version.php index 9b5d27704ae..0c60b3a8345 100644 --- a/mod/forum/version.php +++ b/mod/forum/version.php @@ -24,8 +24,8 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -$module->version = 2010080300; -$module->requires = 2010080300; // Requires this Moodle version +$module->version = 2010082600; +$module->requires = 2010082600; // Requires this Moodle version $module->cron = 60; diff --git a/version.php b/version.php index a9f36f7e139..cf6c1972201 100644 --- a/version.php +++ b/version.php @@ -6,7 +6,7 @@ // This is compared against the values stored in the database to determine // whether upgrades should be performed (see lib/db/*.php) - $version = 2010082502; // YYYYMMDD = date of the last version bump + $version = 2010082600; // YYYYMMDD = date of the last version bump // XX = daily increments $release = '2.0 Preview 4+ (Build: 20100826)'; // Human-friendly version name