Commit 4ea632ff authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Add about me block to profile views (feature req 3093)

parent 467e7116
......@@ -423,6 +423,28 @@ class User {
'title' => get_field('view', 'title', 'id', $systemprofileviewid),
'type' => 'profile',
), $systemprofileviewid, $this->get('id'));
// Add about me block
$aboutme = new BlockInstance(0, array(
'blocktype' => 'profileinfo',
'title' => get_string('aboutme', 'blocktype.internal/profileinfo'),
'view' => $view->get('id'),
'column' => 1,
'order' => 0,
));
$configdata = array('artefactids' => array());
if ($intro = get_field('artefact', 'id', 'owner', $this->get('id'), 'artefacttype', 'introduction')) {
$configdata['artefactids'][] = $intro;
}
else {
$configdata['introtext'] = display_name($this, null, true);
}
if ($this->get('profileicon')) {
$configdata['profileicon'] = $this->get('profileicon');
}
$aboutme->set('configdata', $configdata);
$aboutme->commit();
$view->set_access(array(
array(
'type' => 'loggedin',
......
......@@ -1323,7 +1323,7 @@ function install_system_profile_view() {
)));
$blocktypes = array('myviews' => 1, 'mygroups' => 1, 'myfriends' => 2, 'wall' => 2); // column ids
$installed = get_column_sql('SELECT name FROM {blocktype_installed} WHERE name IN (' . join(',', array_map('db_quote', array_keys($blocktypes))) . ')');
$weights = array(1 => 0, 2 => 0);
$weights = array(1 => 1, 2 => 0); // Leave a space for About Me in the first column
foreach (array_keys($blocktypes) as $blocktype) {
if (in_array($blocktype, $installed)) {
$weights[$blocktypes[$blocktype]]++;
......
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