Commit 2124a30c authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Create initial blog for new users

parent cdb2a5e4
......@@ -148,6 +148,11 @@ function xmldb_artefact_blog_upgrade($oldversion=0) {
}
}
if ($oldversion < 2009081800) {
$subscription = (object) array('plugin' => 'blog', 'event' => 'createuser', 'callfunction' => 'create_default_blog');
ensure_record_exists('artefact_event_subscription', $subscription, $subscription);
}
return true;
}
......
......@@ -64,6 +64,7 @@ $string['createandpublishdesc'] = 'This will create the blog post and make it av
$string['createasdraftdesc'] = 'This will create the blog post, but it will not become available to others until you choose to publish it.';
$string['createblog'] = 'Create Blog';
$string['dataimportedfrom'] = 'Data imported from %s';
$string['defaultblogtitle'] = '%s\'s Blog';
$string['delete'] = 'Delete';
$string['deleteblog?'] = 'Are you sure you want to delete this blog?';
$string['deleteblogpost?'] = 'Are you sure you want to delete this post?';
......
......@@ -62,6 +62,16 @@ class PluginArtefactBlog extends PluginArtefact {
}
public static function get_event_subscriptions() {
return array(
(object)array(
'plugin' => 'blog',
'event' => 'createuser',
'callfunction' => 'create_default_blog',
),
);
}
public static function block_advanced_options_element($configdata, $artefacttype) {
$strartefacttype = get_string($artefacttype, 'artefact.blog');
return array(
......@@ -86,6 +96,14 @@ class PluginArtefactBlog extends PluginArtefact {
);
}
public static function create_default_blog($event, $user) {
$name = display_name($user, null, true);
$blog = new ArtefactTypeBlog(0, (object) array(
'title' => get_string('defaultblogtitle', 'artefact.blog', $name),
'owner' => $user['id'],
));
$blog->commit();
}
}
/**
......
......@@ -27,7 +27,7 @@
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2009033100;
$config->version = 2009081800;
$config->release = '1.0.0';
?>
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