privacy

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