Commit de008efc authored by Nigel McNie's avatar Nigel McNie

[UPSTREAM] Add a new event type - userjoinsgroup.

Triggered, guess when - when a use joins a group!
parent 801c1067
......@@ -1467,6 +1467,13 @@ function xmldb_core_upgrade($oldversion=0) {
add_field($table, $field);
}
if ($oldversion < 2008111201) {
$event = (object)array(
'name' => 'userjoinsgroup',
);
ensure_record_exists('event_type', $event, $event);
}
return $status;
}
......
......@@ -344,18 +344,19 @@ function group_add_user($groupid, $userid, $role=null) {
$groupid = group_param_groupid($groupid);
$userid = group_param_userid($userid);
$cm = new StdClass;
$cm->member = $userid;
$cm->group = $groupid;
$cm->ctime = db_format_timestamp(time());
$gm = new StdClass;
$gm->member = $userid;
$gm->group = $groupid;
$gm->ctime = db_format_timestamp(time());
if (!$role) {
$role = get_field_sql('SELECT gt.defaultrole FROM {grouptype} gt, {group} g WHERE g.id = ? AND g.grouptype = gt.name', array($groupid));
}
$cm->role = $role;
$gm->role = $role;
db_begin();
insert_record('group_member', $cm);
insert_record('group_member', $gm);
delete_records('group_member_request', 'group', $groupid, 'member', $userid);
handle_event('userjoinsgroup', $gm);
db_commit();
}
......
......@@ -650,6 +650,7 @@ function core_install_firstcoredata_defaults() {
'unexpireuser',
'deactivateuser',
'activateuser',
'userjoinsgroup',
'saveartefact',
'deleteartefact',
'saveview',
......
......@@ -27,7 +27,7 @@
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2008111200;
$config->version = 2008111201;
$config->release = '1.1.0beta3dev';
$config->minupgradefrom = 2007080700;
$config->minupgraderelease = '0.8.0 (release tag 0.8.0_RELEASE)';
......
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