diff options
-rw-r--r-- | engine/classes/ElggGroupItemVisibility.php | 10 | ||||
-rw-r--r-- | engine/lib/group.php | 2 |
2 files changed, 11 insertions, 1 deletions
diff --git a/engine/classes/ElggGroupItemVisibility.php b/engine/classes/ElggGroupItemVisibility.php index 2c7e2abb4..743c935da 100644 --- a/engine/classes/ElggGroupItemVisibility.php +++ b/engine/classes/ElggGroupItemVisibility.php @@ -27,6 +27,11 @@ class ElggGroupItemVisibility { public $reasonHidden = ''; /** + * @var bool + */ + public $requireLogin = false; + + /** * Determine visibility of items within a container for the current user * * @param int $container_guid GUID of a container (may/may not be a group) @@ -86,6 +91,11 @@ class ElggGroupItemVisibility { $ret->reasonHidden = self::REASON_NOACCESS; } } + + if ($ret->shouldHideItems && !$user) { + $ret->requireLogin = true; + } + $cache[$cache_key] = $ret; } return $cache[$cache_key]; diff --git a/engine/lib/group.php b/engine/lib/group.php index b81146e61..b32c4bd48 100644 --- a/engine/lib/group.php +++ b/engine/lib/group.php @@ -271,7 +271,7 @@ function group_gatekeeper($forward = true) { $group = get_entity($page_owner_guid); $forward_url = $group ? $group->getURL() : ''; - if ($visibility->reasonHidden !== ElggGroupItemVisibility::REASON_MEMBERSHIP) { + if (!elgg_is_logged_in()) { $_SESSION['last_forward_from'] = current_page_url(); $forward_reason = 'login'; } else { |