aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-07-14 14:01:47 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-07-14 14:01:47 +0000
commitff07d7f469b8f50f9ab96e040354af6bc7ccc706 (patch)
treeef60b24ac2f1ceffc4b45c1abeee5e64b03c1282
parent7dc6d802a7c4d6d936cbd6ec6a4837a109c72268 (diff)
downloadelgg-ff07d7f469b8f50f9ab96e040354af6bc7ccc706.tar.gz
elgg-ff07d7f469b8f50f9ab96e040354af6bc7ccc706.tar.bz2
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
-rw-r--r--mod/groups/actions/join.php2
-rw-r--r--mod/groups/views/default/groups/groupprofile.php28
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">';