Friends only access level

Hi! It would be nice to have a "Friends Only" access level without making friends collectios.

May be "private" it's too closed and "logged in users" too open to some communities.

 

  • Hi Dave, im going to try to do a plugin in order to have a "Friends Only" access level.

    Any advices?

  • Hello, i have coded a little trick in order to have a "Friends Only" access level, i have tested it on my elgg 1.1 with blog plugin and it seems to work correctly.

    In /engine/lib/access.php:

    Line 165:

    //if (empty($sql))
                        //$sql = " ({$table_prefix}access_id in {$access} or ({$table_prefix}access_id = 0 and {$table_prefix}owner_guid = $owner))";
                    //HACK
                    global $CONFIG;
                    if (empty($sql))
                        $sql = " ({$table_prefix}access_id in {$access} or {$table_prefix}owner_guid = $owner or ({$table_prefix}access_id = -1 and {$table_prefix}owner_guid in (select guid_one from {$CONFIG->dbprefix}entity_relationships where guid_two = $owner and relationship = 'friend')))";

     

    Line 200:

    //$tmp_access_array = array(0 => elgg_echo("PRIVATE"), 1 => elgg_echo("LOGGED_IN"), 2 => elgg_echo("PUBLIC"));
                    //HACK
                    $tmp_access_array = array(0 => elgg_echo("PRIVATE"), 1 => elgg_echo("LOGGED_IN"), 2 => elgg_echo("PUBLIC"), -1 => elgg_echo("FRIENDS"));

     

    Line 439:

    //HACK
            define('ACCESS_FRIENDS',-1);

     

    I hope this is okay :)

    Regards!