Commit 7f65b938 authored by Ghada El-Zoghbi's avatar Ghada El-Zoghbi Committed by Robert Lyon

Bug 1745042: set link and icon attribute for socialprofiles

When a user shares their socialprofile on their
profile page and another user searches
for that social profile (using elsaticsearch),
the icon attribute is never set.
Because social profiles are external to Mahara,
we can display the link to users.

Sponsored by The Australian National University

behatnotneeded

Change-Id: I94282bed7904f9d37a50b8e0fd32c5f2d174c704
parent 7b5e45c4
......@@ -312,22 +312,28 @@ class ElasticsearchType_artefact extends ElasticsearchType {
$record->link = 'artefact/plans/plan.php?id=' . $record->parent;
}
break;
case 'socialprofile' :
safe_require ( 'artefact', 'internal' );
$record->note = str_replace ( array (
}
}
// The socialprofile link is for external sites so we can display it for all users.
if ($record->artefacttype == 'socialprofile') {
safe_require ( 'artefact', 'internal' );
$record->note = str_replace ( array (
"\r\n",
"\n",
"\r"
), ' ', strip_tags ( $record->note ) );
$socialprofile = new ArtefactTypeSocialprofile ( $record->id );
$icons = $socialprofile->get_profile_icons ( array (
), ' ', strip_tags ( $record->note ) );
$socialprofile = new ArtefactTypeSocialprofile ( $record->id );
$icons = $socialprofile->get_profile_icons ( array (
$record
) );
if (! empty ( $icons )) {
$record->link = $icons [0]->link;
$record->icon = $icons [0]->icon;
}
break;
) );
if (! empty ( $icons )) {
$record->link = $icons [0]->link;
$record->icon = $icons [0]->icon;
}
else {
// Instantiate the attribute used by the template.
$record->icon = '';
}
}
......
......@@ -15,7 +15,7 @@
<img src="{$record->icon}" alt="{$record->note}">
<h3 class="title list-group-item-heading text-inline">
{if $record->link}
<a href="{$WWWROOT}{$record->link}">
<a href="{$record->link}">
{$record->title|str_shorten_html:50:true|safe}
</a>
{else}
......
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