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

Comments

  • DhrupDeScoop

    looks like that it is doing exactly what you have coded it to do ;-) so "if the user selects only friends, only friends can see it. but the user does not" --> then most likely -- you've not coded what you're saying [ the "'say what you mean and mean what you say".. syndrome ? ;-) ]

  • phpmaster

    example code ?

  • DhrupDeScoop

    There's nothing wrong with the code - It seems to me that that is not what you meant to accomplish - in which case, read over your code:-

    if($owner->user_friends_access == 'public' || (isloggedin() && $owner->user_friends_access == 'friends' && $owner->isFriend())){

    quite carefully... and see if a real php master would ask what de heck that code is doing Vs what you want the code to do ;-)

    I'm trying to read your mind here ;-P and your code does not match your thoughts ;-oO lolz..

  • phpmaster

    I want to accomplish is that the user can also view active content if sierto privacy "just friends" or "private." because if the private user chooses can not view their own content

  • phpmaster

    A: owner
    B: friends

    A: hide certain content on their profile. select "only friends"

    B: the friend can see it but A is not
    the same owner can not see it but friends if

    know Spanish?

  • DhrupDeScoop

    Read over your code quite carefully and ask " Is that what I really want to do ? " ;-) and get rid of that silly "PhpMaster" nickname ;-P nobody is a "master" - we're all students.. ;-o

  • phpmaster

    I got php master that was the first thing that occurred to me. I only ask for help

  • DhrupDeScoop

    No, yo no sé español, pero ...
    traductor de Google! ;-)