Commit aa8817f8 authored by Maria Sorica's avatar Maria Sorica Committed by Robert Lyon
Browse files

Bug 1724846: Add userchangegroup role event trigger

behatnotneeded

Change-Id: I3ac817a31002b50687490a900d68ddc9ae8ace6d
parent e6ae6db4
......@@ -5866,5 +5866,13 @@ function xmldb_core_upgrade($oldversion=0) {
create_table($table);
}
if ($oldversion < 2018061600) {
log_debug('Adding new event type "userchangegrouprole"');
$event = (object)array(
'name' => 'userchangegrouprole'
);
ensure_record_exists('event_type', $event, $event);
}
return $status;
}
......@@ -120,6 +120,18 @@ function group_change_role($groupid, $userid, $role) {
}
set_field('group_member', 'role', $role, 'group', $groupid, 'member', $userid);
$data = new StdClass;
$data->user = $userid;
$data->group = $groupid;
$data->role = $role;
handle_event('userchangegrouprole', array(
'id' => $groupid,
'eventfor' => 'group',
'parentid' => $userid,
'parenttype' => 'user',
'rules' => $data)
);
}
/**
......
......@@ -920,6 +920,7 @@ function core_install_firstcoredata_defaults() {
'activateuser',
'userjoinsgroup',
'userleavesgroup',
'userchangegrouprole',
'saveartefact',
'deleteartefact',
'deleteartefacts',
......
......@@ -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 = 2018050201;
$config->version = 2018061600;
$config->series = '18.10';
$config->release = '18.10dev';
$config->minupgradefrom = 2015030409;
......
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