﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc,difficulty
620,"""Friends only"" Level access",mmontesp,,"Hi!

I have made a little hack in order to have a ""friends only"" level acces without making friends collections. It avoid data redundancy of a collection ""All my friends"" on data base.

The changes:

File /engine/lib/access.php Line 165:

Original:

{{{
if (empty($sql))
    $sql = "" ({$table_prefix}access_id in {$access} or ({$table_prefix}access_id = 0 and {$table_prefix}owner_guid = $owner))"";
}}}
 
Modified:

{{{
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')))"";
}}}

 
File /engine/lib/access.php Line 200:

Original:

{{{
$tmp_access_array = array(0 => elgg_echo(""PRIVATE""), 1 => elgg_echo (""LOGGED_IN""), 2 => elgg_echo(""PUBLIC""));
}}}

Modified:

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

File /engine/lib/access.php Line 439: 

Added:

{{{
define('ACCESS_FRIENDS',-1);
}}}
 
The modified file is attached

Regards!",Enhancement,closed,normal,Elgg 1.5,Core,1.1,minor,fixed,"friends, access, level access",brettp,
