Commit cf518acd authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Set activity prefs for first admin; make all admin activity prefs default to email

parent 7a13ca9e
......@@ -162,13 +162,21 @@ function activity_set_defaults($eventdata) {
function activity_add_admin_defaults($userids) {
$activitytypes = get_records_array('activity_type', 'admin', 1);
$haveemail = in_array('email', array_map(create_function('$a', 'return $a->name;'),
plugins_installed('notification')));
if ($haveemail) {
$method = 'email';
}
else {
$method = 'internal';
}
foreach ($activitytypes as $type) {
foreach ($userids as $id) {
if (!record_exists('usr_activity_preference', 'usr', $id, 'activity', $type->id)) {
insert_record('usr_activity_preference', (object)array(
'usr' => $id,
'activity' => $type->id,
'method' => 'internal',
'method' => $method,
));
}
}
......
......@@ -606,6 +606,7 @@ function core_install_lastcoredata_defaults() {
set_profile_field($user->id, 'lastname', $user->lastname);
set_config('installed', true);
handle_event('createuser', $user->id);
activity_add_admin_defaults(array($user->id));
db_commit();
// if we're installing, set up the block categories here and then poll the plugins.
......
Supports Markdown
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