aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-04-16 20:50:31 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-04-16 20:50:31 +0000
commit412032ca0bf47896291a0a4074245cd2660cb3a7 (patch)
treea815437705fa8295a107c5e1757ab764ae26feeb
parent0801d94f4095d3658a00a0a57f4166cb4f707eda (diff)
downloadelgg-412032ca0bf47896291a0a4074245cd2660cb3a7.tar.gz
elgg-412032ca0bf47896291a0a4074245cd2660cb3a7.tar.bz2
Only showing group access levels within group contexts.
Not showing unrelated access levels within group contexts. git-svn-id: http://code.elgg.org/elgg/trunk@5782 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--mod/groups/start.php42
1 files changed, 23 insertions, 19 deletions
diff --git a/mod/groups/start.php b/mod/groups/start.php
index 9db55e392..f6f10b27a 100644
--- a/mod/groups/start.php
+++ b/mod/groups/start.php
@@ -17,7 +17,7 @@
global $CONFIG;
- // Set up the menu
+ // Set up the menu
add_menu(elgg_echo('groups'), $CONFIG->wwwroot . "pg/groups/world/");
// Register a page handler, so we can have nice URLs
@@ -235,7 +235,7 @@
add_submenu_item(elgg_echo('groups:yours'), $CONFIG->wwwroot . "pg/groups/member/" . $_SESSION['user']->username, '1groupslinks');
}
add_submenu_item(elgg_echo('groups:all'), $CONFIG->wwwroot . "pg/groups/world/", '1groupslinks');
-
+
if (isloggedin()) {
add_submenu_item(elgg_echo('groups:invitations'), $CONFIG->wwwroot . "pg/groups/invitations/" . $_SESSION['user']->username, '1groupslinks');
}
@@ -417,26 +417,30 @@
function groups_write_acl_plugin_hook($hook, $entity_type, $returnvalue, $params)
{
$page_owner = page_owner_entity();
- // get all groups if logged in
- if ($loggedin = get_loggedin_user()) {
- $groups = elgg_get_entities_from_relationship(array('relationship' => 'member', 'relationship_guid' => $loggedin->getGUID(), 'inverse_relationship' => FALSE, 'limit' => 999));
- if (is_array($groups)) {
- foreach ($groups as $group) {
- $returnvalue[$group->group_acl] = elgg_echo('groups:group') . ': ' . $group->name;
- }
+ $loggedin = get_loggedin_user();
+
+ // only insert group access for current group
+ if ($page_owner instanceof ElggGroup && $loggedin) {
+ if ($page_owner->isMember($loggedin)) {
+ $returnvalue[$page_owner->group_acl] = elgg_echo('groups:group') . ': ' . $page_owner->name;
+
+ // remove friends access
+ unset($returnvalue[ACCESS_FRIENDS]);
+ }
+ } else {
+ // remove all group access ids the user has
+ $groups = elgg_get_entities_from_relationship(array(
+ 'relationship' => 'member',
+ 'relationship_guid' => $loggedin->getGUID(),
+ 'inverse_relationship' => FALSE,
+ 'limit' => 999
+ ));
+
+ foreach ($groups as $group) {
+ unset($returnvalue[$group->group_acl]);
}
}
- // This doesn't seem to do anything.
- // There are no hooks to override container permissions for groups
-//
-// if ($page_owner instanceof ElggGroup)
-// {
-// if (can_write_to_container())
-// {
-// $returnvalue[$page_owner->group_acl] = elgg_echo('groups:group') . ": " . $page_owner->name;
-// }
-// }
return $returnvalue;
}