Commit 4a6762d6 authored by Martyn Smith's avatar Martyn Smith Committed by Martyn Smith
Browse files

Activity preference defaults for new users

parent 49e26a9e
...@@ -406,5 +406,17 @@ function activity_get_users($activitytype, $userids=null, $userobjs=null, $admin ...@@ -406,5 +406,17 @@ function activity_get_users($activitytype, $userids=null, $userobjs=null, $admin
return get_records_sql_array($sql, $values); return get_records_sql_array($sql, $values);
} }
/**
* this function inserts a default set of activity preferences for a given user
* id
*/
function activity_set_defaults($user_id) {
$activitytypes = get_records_array('activity_type', 'admin', 0);
foreach ($activitytypes as $type) {
$USER->set_activity_preference($type->name, 'internal');
}
}
?> ?>
...@@ -653,6 +653,13 @@ function handle_event($event, $data) { ...@@ -653,6 +653,13 @@ function handle_event($event, $data) {
if (!$e = get_record('event_type', 'name', $event)) { if (!$e = get_record('event_type', 'name', $event)) {
throw new Exception("Invalid event"); throw new Exception("Invalid event");
} }
// this is here because the core can't listen to events
// @todo, this is VERY ugly, and someone should fix it
if ($event == 'createuser') {
activity_set_defaults($event->id);
}
$plugintypes = plugin_types(); $plugintypes = plugin_types();
foreach ($plugintypes as $name) { foreach ($plugintypes as $name) {
if ($subs = get_records_array($name . '_event_subscription', 'event', $event)) { if ($subs = get_records_array($name . '_event_subscription', 'event', $event)) {
......
...@@ -28,7 +28,7 @@ defined('INTERNAL') || die(); ...@@ -28,7 +28,7 @@ defined('INTERNAL') || die();
$config = new StdClass; $config = new StdClass;
$config->version = 2007011600; $config->version = 2007011600;
$config->release = '0.3.6'; $config->release = '0.3.7';
$config->minupgradefrom = 2006121501; $config->minupgradefrom = 2006121501;
$config->minupgraderelease = '0.1 (build tag BUILD_20061215)'; $config->minupgraderelease = '0.1 (build tag BUILD_20061215)';
......
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