aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2012-02-09 07:38:30 -0500
committerCash Costello <cash.costello@gmail.com>2012-02-09 07:38:30 -0500
commit83d9d13b561342447a2d84682e2692e8bf8f260e (patch)
treebcbe1b2ae817b286af2487e367bcb6182e4f13d4 /engine
parent488575ba727cf85f2da5c86513efa0307aaed894 (diff)
downloadelgg-83d9d13b561342447a2d84682e2692e8bf8f260e.tar.gz
elgg-83d9d13b561342447a2d84682e2692e8bf8f260e.tar.bz2
Fixes #4361 corrects forwarding logic for closed groups
Diffstat (limited to 'engine')
-rw-r--r--engine/lib/group.php26
1 files changed, 17 insertions, 9 deletions
diff --git a/engine/lib/group.php b/engine/lib/group.php
index 29330eeca..feb1f1e7f 100644
--- a/engine/lib/group.php
+++ b/engine/lib/group.php
@@ -261,16 +261,24 @@ function group_gatekeeper($forward = true) {
if ($group = elgg_get_page_owner_entity()) {
if ($group instanceof ElggGroup) {
$url = $group->getURL();
- if (
- ((!elgg_is_logged_in()) && (!$group->isPublicMembership())) ||
- ((!$group->isMember(elgg_get_logged_in_user_entity()) && (!$group->isPublicMembership())))
- ) {
- $allowed = false;
- }
+ if (!$group->isPublicMembership()) {
+ // closed group so must be member or an admin
+
+ if (!elgg_is_logged_in()) {
+ $allowed = false;
+ if ($forward == true) {
+ $_SESSION['last_forward_from'] = current_page_url();
+ register_error(elgg_echo('loggedinrequired'));
+ forward('', 'login');
+ }
+ } else if (!$group->isMember(elgg_get_logged_in_user_entity())) {
+ $allowed = false;
+ }
- // Admin override
- if (elgg_is_admin_logged_in()) {
- $allowed = true;
+ // Admin override
+ if (elgg_is_admin_logged_in()) {
+ $allowed = true;
+ }
}
}
}