]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Better logic for when to forward to login
authorSteve Clay <steve@mrclay.org>
Fri, 7 Sep 2012 06:20:56 +0000 (02:20 -0400)
committerSteve Clay <steve@mrclay.org>
Fri, 7 Sep 2012 06:20:56 +0000 (02:20 -0400)
engine/classes/ElggGroupItemVisibility.php
engine/lib/group.php

index 2c7e2abb4d906ef5f854ef9764a32fb8f8f7ea43..743c935dadaf639a1130178a97a485a4547acadb 100644 (file)
@@ -26,6 +26,11 @@ class ElggGroupItemVisibility {
         */
        public $reasonHidden = '';
 
+       /**
+        * @var bool
+        */
+       public $requireLogin = false;
+
        /**
         * Determine visibility of items within a container for the current user
         *
@@ -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];
index b81146e6129484898c24854982ffef1a8bb74b67..b32c4bd4863c8838ed603453f518d0ba84b1b73e 100644 (file)
@@ -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 {