Commit b48e6e62 authored by Cecilia Vela Gurovic's avatar Cecilia Vela Gurovic
Browse files

Bug 1712681: topic in forum 'createtopicusers' check

behatnotneeded

Change-Id: I488cc4cfffdc9c30f67f001c6d7ce72ae71cc20d
parent 5374019d
......@@ -67,7 +67,7 @@ $membership = user_can_access_forum((int)$forumid);
$moderator = (bool)($membership & INTERACTION_FORUM_MOD);
$admintutor = (bool) group_get_user_admintutor_groups();
if (!$membership || ($forumconfig['createtopicusers']->value == 'moderators' && !$moderator)) {
if (!$membership || (isset($forumconfig['createtopicusers']) && $forumconfig['createtopicusers']->value == 'moderators' && !$moderator)) {
throw new AccessDeniedException(get_string('cantaddtopic', 'interaction.forum'));
}
......
......@@ -5074,5 +5074,17 @@ function xmldb_core_upgrade($oldversion=0) {
}
}
if ($oldversion < 2017082900) {
log_debug('Fix missing property in group Forums');
$sql = "INSERT INTO {interaction_forum_instance_config} (forum,field,value)
SELECT DISTINCT forum, 'createtopicusers', 'members'
FROM {interaction_forum_instance_config}
WHERE forum NOT IN (
SELECT DISTINCT forum FROM {interaction_forum_instance_config}
WHERE field = 'createtopicusers'
)";
execute_sql($sql);
}
return $status;
}
......@@ -16,7 +16,7 @@ $config = new stdClass();
// See https://wiki.mahara.org/wiki/Developer_Area/Version_Numbering_Policy
// For upgrades on stable branches, increment the version by one. On master, use the date.
$config->version = 2017071100;
$config->version = 2017082900;
$config->series = '17.10';
$config->release = '17.10dev';
$config->minupgradefrom = 2012080604;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment