provide an edit button for the profile page

This commit is contained in:
Mario Vavti 2016-02-25 22:50:16 +01:00
parent 2a0d4a2011
commit b2474334a7
2 changed files with 8 additions and 4 deletions

View File

@ -1237,10 +1237,6 @@ function advanced_profile(&$a) {
if(! perm_is_allowed($a->profile['profile_uid'],get_observer_hash(),'view_profile')) if(! perm_is_allowed($a->profile['profile_uid'],get_observer_hash(),'view_profile'))
return ''; return '';
$o = '';
$o .= '<h2>' . t('Profile') . '</h2>';
if($a->profile['name']) { if($a->profile['name']) {
$tpl = get_markup_template('profile_advanced.tpl'); $tpl = get_markup_template('profile_advanced.tpl');
@ -1351,6 +1347,10 @@ function advanced_profile(&$a) {
$profile['extra_fields'] = $a->profile['extra_fields']; $profile['extra_fields'] = $a->profile['extra_fields'];
} }
$is_owner = (($a->profile['profile_uid'] == local_channel()) ? true : false);
$edit = (($is_owner) ? array('link' => $a->get_baseurl() . '/profiles/' . $a->profile['profile_uid'], 'label' => t('Edit')) : '');
$things = get_things($a->profile['profile_guid'],$a->profile['profile_uid']); $things = get_things($a->profile['profile_guid'],$a->profile['profile_uid']);
// logger('mod_profile: things: ' . print_r($things,true), LOGGER_DATA); // logger('mod_profile: things: ' . print_r($things,true), LOGGER_DATA);
@ -1360,6 +1360,7 @@ function advanced_profile(&$a) {
'$canlike' => (($profile['canlike'])? true : false), '$canlike' => (($profile['canlike'])? true : false),
'$likethis' => t('Like this thing'), '$likethis' => t('Like this thing'),
'$profile' => $profile, '$profile' => $profile,
'$edit' => $edit,
'$things' => $things '$things' => $things
)); ));
} }

View File

@ -12,6 +12,9 @@
<i class="icon-thumbs-up-alt" title="{{$profile.likethis}}"></i> <i class="icon-thumbs-up-alt" title="{{$profile.likethis}}"></i>
</button> </button>
{{/if}} {{/if}}
{{if $edit}}
<a href="{{$edit.link}}" class="btn btn-primary btn-xs"><i class="icon-pencil"></i>&nbsp;{{$edit.label}}</a>
{{/if}}
</div> </div>
<h2>{{$title}}</h2> <h2>{{$title}}</h2>
<div class="clear"></div> <div class="clear"></div>