September 30, 2008

Out of the box, Elgg 1.1 has three access levels: private, logged-in users, and public.

A few people have asked about how to add a further access level: friends. Currently, the only way to give friends access to an item is to create a friends collection, then specify that collection for the access level. The problem with this approach is that every you add or remove a friend, you need to update your collection manually.

The Elgg development philosophy is not to modify the core files, but instead to write plugins, if you need to modify any of the core functionality. However, in this case, there are no Elgg events that we can hook into, as access level is such a fundamental part of the core. Thus, we are forced to modify a couple of the core files.

Note that this won’t work for MySQL versions prior to 4.1, as they do not support subqueries.

For the modules that come with Elgg out of the box, only the pages module needs to be modified, as it uses a “write” permission that other modules do not use. Read permissions are handled by the modification to the core file access.php.