From 353fac6f48b1e39f78bb8b0911967e0b06b8dd6c Mon Sep 17 00:00:00 2001 From: Rajesh Taneja Date: Thu, 31 Jan 2013 14:01:41 +0800 Subject: [PATCH] MDL-37633 Forum: Allow fronpage user to have forum:allowforcesubscribe capability by default Conflicts: mod/forum/version.php --- mod/forum/db/access.php | 3 ++- mod/forum/db/upgrade.php | 11 ++++++++++- mod/forum/upgrade.txt | 8 ++++++++ mod/forum/version.php | 2 +- 4 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 mod/forum/upgrade.txt diff --git a/mod/forum/db/access.php b/mod/forum/db/access.php index 43151c69f11..3b67e401232 100644 --- a/mod/forum/db/access.php +++ b/mod/forum/db/access.php @@ -341,7 +341,8 @@ $capabilities = array( 'archetypes' => array( 'student' => CAP_ALLOW, 'teacher' => CAP_ALLOW, - 'editingteacher' => CAP_ALLOW + 'editingteacher' => CAP_ALLOW, + 'frontpage' => CAP_ALLOW ) ), ); diff --git a/mod/forum/db/upgrade.php b/mod/forum/db/upgrade.php index 9d828297c61..febed91181b 100644 --- a/mod/forum/db/upgrade.php +++ b/mod/forum/db/upgrade.php @@ -57,7 +57,16 @@ function xmldb_forum_upgrade($oldversion) { // Moodle v2.4.0 release upgrade line // Put any upgrade step following this - + // Forcefully assign mod/forum:allowforcesubscribe to frontpage role, as we missed that when + // capability was introduced. + if ($oldversion < 2012112901) { + // If capability mod/forum:allowforcesubscribe is defined then set it for frontpage role. + if (get_capability_info('mod/forum:allowforcesubscribe')) { + assign_legacy_capabilities('mod/forum:allowforcesubscribe', array('frontpage' => CAP_ALLOW)); + } + // Forum savepoint reached. + upgrade_mod_savepoint(true, 2012112901, 'forum'); + } return true; } diff --git a/mod/forum/upgrade.txt b/mod/forum/upgrade.txt new file mode 100644 index 00000000000..d690d2642f8 --- /dev/null +++ b/mod/forum/upgrade.txt @@ -0,0 +1,8 @@ +This files describes API changes in /mod/forum/*, +information provided here is intended especially for developers. + + +=== 2.3.5, 2.4.2 === +* mod/forum:allowforcesubscribe capability will be forcefully assigned to frontpage role, as it was mistakenly missed off +when the capability was initially created. If you don't want users with frontpage role to get forum (with forcesubscribe) emails, +then please remove this capability for frontpage role. diff --git a/mod/forum/version.php b/mod/forum/version.php index 0a9384e95f6..d43c1fae053 100644 --- a/mod/forum/version.php +++ b/mod/forum/version.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die(); -$module->version = 2012112900; // The current module version (Date: YYYYMMDDXX) +$module->version = 2012112901; // The current module version (Date: YYYYMMDDXX) $module->requires = 2012112900; // Requires this Moodle version $module->component = 'mod_forum'; // Full name of the plugin (used for diagnostics) $module->cron = 60;