From a9010a793da35f76d01edbca97ec40079cc0a9e2 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 28 Mar 2009 15:20:08 +0000 Subject: group members can now work with photo albums --- start.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'start.php') diff --git a/start.php b/start.php index e2fbbe15e..dc1456a57 100644 --- a/start.php +++ b/start.php @@ -41,6 +41,8 @@ register_entity_type('object','album'); add_group_tool_option('photos',elgg_echo('tidypics:enablephotos'),true); + + register_plugin_hook('permissions_check', 'object', 'tidypics_permission_override'); } /** @@ -170,7 +172,29 @@ } } + + /** + * Override permissions for group albums and images + * + */ + function tidypics_permission_override($hook, $entity_type, $returnvalue, $params) + { + $entity = $params['entity']; + $user = $params['user']; + if ($entity->subtype == get_subtype_id('object', 'album')) { + // test that the user can edit the container + return can_write_to_container(0, $entity->container_guid); + } + + if ($entity->subtype == get_subtype_id('object', 'image')) { + // test that the user can edit the container + return can_write_to_container(0, $entity->container_guid); + } + + return false; + } + /** * Populates the ->getUrl() method for file objects * -- cgit v1.2.3