diff options
Diffstat (limited to 'mod/groups/start.php')
-rw-r--r-- | mod/groups/start.php | 51 |
1 files changed, 14 insertions, 37 deletions
diff --git a/mod/groups/start.php b/mod/groups/start.php index fdf3b9e45..7c6d39b9d 100644 --- a/mod/groups/start.php +++ b/mod/groups/start.php @@ -195,50 +195,27 @@ * */ function groups_submenus() { - global $CONFIG; // Get the page owner entity - $page_owner = page_owner_entity(); - - // Submenu items for all group pages - if ($page_owner instanceof ElggGroup && get_context() == 'groups') { - if (isloggedin()) { - if ($page_owner->canEdit()) { - add_submenu_item(elgg_echo('groups:invite'),$CONFIG->wwwroot . "mod/groups/invite.php?group_guid={$page_owner->getGUID()}", '1groupsactions'); - if (!$page_owner->isPublicMembership()) - add_submenu_item(elgg_echo('groups:membershiprequests'),$CONFIG->wwwroot . "mod/groups/membershipreq.php?group_guid={$page_owner->getGUID()}", '1groupsactions'); - } - if ($page_owner->isMember($_SESSION['user'])) { - if ($page_owner->getOwner() != $_SESSION['guid']) { - $url = elgg_add_action_tokens_to_url($CONFIG->wwwroot . "action/groups/leave?group_guid=" . $page_owner->getGUID()); - add_submenu_item(elgg_echo('groups:leave'), $url, '1groupsactions'); - } - } else { - if ($page_owner->isPublicMembership()) { - $url = elgg_add_action_tokens_to_url($CONFIG->wwwroot . "action/groups/join?group_guid={$page_owner->getGUID()}"); - add_submenu_item(elgg_echo('groups:join'), $url, '1groupsactions'); - } else { - $url = elgg_add_action_tokens_to_url($CONFIG->wwwroot . "action/groups/joinrequest?group_guid={$page_owner->getGUID()}"); - add_submenu_item(elgg_echo('groups:joinrequest'), $url, '1groupsactions'); - } - } - } - } + $page_owner = page_owner_entity(); - // Add submenu options - if (get_context() == 'groups' && !($page_owner instanceof ElggGroup)) { - if (isloggedin()) { - add_submenu_item(elgg_echo('groups:owned'), $CONFIG->wwwroot . "pg/groups/owned/" . $_SESSION['user']->username, '1groupslinks'); - add_submenu_item(elgg_echo('groups:yours'), $CONFIG->wwwroot . "pg/groups/member/" . $_SESSION['user']->username, '1groupslinks'); + if (get_context() == 'groups') { + if ($page_owner instanceof ElggGroup) { + if (isloggedin() && $page_owner->canEdit() && !$page_owner->isPublicMembership()) { + $url = "{$CONFIG->wwwroot}mod/groups/membershipreq.php?group_guid={$page_owner->getGUID()}"; + add_submenu_item(elgg_echo('groups:membershiprequests'), $url, '1groupsactions'); } - 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'); + } else { + add_submenu_item(elgg_echo('groups:all'), "{$CONFIG->wwwroot}pg/groups/world/", '1groupslinks'); + + if ($user = get_loggedin_user()) { + add_submenu_item(elgg_echo('groups:owned'), "{$CONFIG->wwwroot}pg/groups/owned/$user->username", '1groupslinks'); + add_submenu_item(elgg_echo('groups:yours'), "{$CONFIG->wwwroot}pg/groups/member/$user->username", '1groupslinks'); + add_submenu_item(elgg_echo('groups:invitations'), "{$CONFIG->wwwroot}pg/groups/invitations/$user->username", '1groupslinks'); } } - + } } /** |