Log in


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');




in mod/myplugin/views/deafults/usersettings/user.php


$user = page_owner_entity();

if ($user) {


<h3><?php echo elgg_echo('who can see my friends'); ?></h3>



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));



<?php }



in myplugin



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










my problem is :

if the user selects only friends, only friends can see it. but the user does not


  • DhrupDeScoop 986 days ago

    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 986 days ago

    example code ?

  • DhrupDeScoop 986 days ago

    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 986 days ago

    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 986 days ago

    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 986 days ago

    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 986 days ago

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

  • DhrupDeScoop 985 days ago

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