From 46edecfca2e2562941b5b3882db185399a77b441 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Thu, 21 Aug 2008 05:50:38 +0000 Subject: [PATCH] Made GroupSubsites respect disable_subsite_filter, and added an accessor method for 3rd parties to use this functionality. --- code/GroupSubsites.php | 2 ++ code/Subsite.php | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/code/GroupSubsites.php b/code/GroupSubsites.php index 6034029..7982a00 100644 --- a/code/GroupSubsites.php +++ b/code/GroupSubsites.php @@ -25,6 +25,8 @@ class GroupSubsites extends DataObjectDecorator { * Update any requests to limit the results to the current site */ function augmentSQL(SQLQuery &$query) { + if(Subsite::$disable_subsite_filter) return; + // If you're querying by ID, ignore the sub-site - this is a bit ugly... if(!$query->where || (strpos($query->where[0], ".`ID` = ") === false && strpos($query->where[0], ".ID = ") === false)) { diff --git a/code/Subsite.php b/code/Subsite.php index a004d6b..6e0a472 100644 --- a/code/Subsite.php +++ b/code/Subsite.php @@ -356,6 +356,13 @@ SQL; self::$disable_subsite_filter = false; return $result; } + + /** + * Disable the sub-site filtering; queries will select from all subsites + */ + static function disable_subsite_filter($disabled = true) { + self::$disable_subsite_filter = $disabled; + } } /**