i need help with this function
in star.php
register_plugin_hook('action', 'usersettings/save', 'user_friends_save_access');
function user_friends_save_access(){
$user = $_SESSION['user'];
$user->user_friends_access = get_input('user_friends_access');
$user->save();
}
in mod/myplugin/views/deafults/usersettings/user.php
<?php
$user = page_owner_entity();
if ($user) {
?>
<h3><?php echo elgg_echo('who can see my friends'); ?></h3>
<p>
<?php
echo elgg_echo('friends privacy');
echo elgg_view('input/pulldown', array(
'internalname' => 'user_friends_access',
'options_values' => array(
'public' => elgg_echo('public'),
'friends' => elgg_echo('only friends'),
'hidden' => elgg_echo('private')
),
'value' => $user->user_friends_access));
?>
</p>
<?php }
?>
in myplugin
<?php
if($owner->user_friends_access == 'public' || (isloggedin() && $owner->user_friends_access == 'friends' && $owner->isFriend())){
?>
<div>
<span>title</span>
<span>content</span>
</div>
<?php
}
?>
my problem is :
if the user selects only friends, only friends can see it. but the user does not
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.