diff options
Diffstat (limited to 'mod/groups')
-rw-r--r-- | mod/groups/actions/join.php | 2 | ||||
-rw-r--r-- | 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 = '<div class="content_header_options">'; |