From ff07d7f469b8f50f9ab96e040354af6bc7ccc706 Mon Sep 17 00:00:00 2001 From: brettp Date: Wed, 14 Jul 2010 14:01:47 +0000 Subject: Admin users can join groups. Don't request to join a closed group if admin. git-svn-id: http://code.elgg.org/elgg/trunk@6702 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/groups/actions/join.php | 2 +- mod/groups/views/default/groups/groupprofile.php | 28 ++++++++++++++++-------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/mod/groups/actions/join.php b/mod/groups/actions/join.php index 1612587c8..55da1a17c 100644 --- a/mod/groups/actions/join.php +++ b/mod/groups/actions/join.php @@ -32,7 +32,7 @@ if (($user instanceof ElggUser) && ($group instanceof ElggGroup)) { - if ($group->isPublicMembership()) + if ($group->isPublicMembership() || $group->canEdit($user->guid)) { if ($group->join($user)) { diff --git a/mod/groups/views/default/groups/groupprofile.php b/mod/groups/views/default/groups/groupprofile.php index ab1990370..13b244f88 100644 --- a/mod/groups/views/default/groups/groupprofile.php +++ b/mod/groups/views/default/groups/groupprofile.php @@ -15,6 +15,7 @@ elgg_push_breadcrumb(elgg_echo('groups:all'), "{$vars['url']}pg/groups/world"); // create user actions $actions = array(); + if ($vars['entity']->canEdit()) { // breadcrumb trail elgg_push_breadcrumb(elgg_echo('groups:yours'), "{$vars['url']}pg/groups/member/{$user->username}"); @@ -22,24 +23,33 @@ if ($vars['entity']->canEdit()) { // edit and invite $actions["mod/groups/edit.php?group_guid={$vars['entity']->getGUID()}"] = elgg_echo('groups:edit'); $actions["mod/groups/invite.php?group_guid={$vars['entity']->getGUID()}"] = elgg_echo('groups:invite'); -} elseif ($vars['entity']->isMember($user)) { +} + +if ($vars['entity']->isMember($user)) { // breadcrumb trail elgg_push_breadcrumb(elgg_echo('groups:yours'), "{$vars['url']}pg/groups/member/{$user->username}"); // leave $url = elgg_add_action_tokens_to_url("action/groups/leave?group_guid={$vars['entity']->getGUID()}"); $actions[$url] = elgg_echo('groups:leave'); -} elseif ($vars['entity']->isPublicMembership()) { - // join - $url = elgg_add_action_tokens_to_url("action/groups/join?group_guid={$vars['entity']->getGUID()}"); - $actions[$url] = elgg_echo('groups:join'); } else { - // request membership - $url = elgg_add_action_tokens_to_url("action/groups/joinrequest?group_guid={$vars['entity']->getGUID()}"); - $actions[$url] = elgg_echo('groups:joinrequest'); + // join + // admins can always join. + if ($vars['entity']->isPublicMembership() || $vars['entity']->canEdit()) { + $url = elgg_add_action_tokens_to_url("action/groups/join?group_guid={$vars['entity']->getGUID()}"); + $actions[$url] = elgg_echo('groups:join'); + } else { + // request membership + $url = elgg_add_action_tokens_to_url("action/groups/joinrequest?group_guid={$vars['entity']->getGUID()}"); + $actions[$url] = elgg_echo('groups:joinrequest'); + } } -// build aciton buttons +/* + +*/ + +// build action buttons $action_buttons = ''; if (!empty($actions)) { $action_buttons = '
'; -- cgit v1.2.3