]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
New events for overriding scope checks
authorEvan Prodromou <evan@status.net>
Tue, 20 Mar 2012 20:38:56 +0000 (16:38 -0400)
committerEvan Prodromou <evan@status.net>
Tue, 20 Mar 2012 20:39:43 +0000 (16:39 -0400)
EVENTS.txt
classes/Notice.php

index 5fb775c76562e94cc2dccaf9dc3891a447d726cc..eb3edb9b138d8587ae98c8f7be4c93fbcb5e261f 100644 (file)
@@ -1430,3 +1430,15 @@ StartShowNoticeOptionItems: Before showing first controls in a notice list item;
 
 EndShowNoticeOptionItems: After showing last controls in a notice list item; inside the div
 - $nli: NoticeListItem being shown
+
+StartNoticeInScope: Before checking if a notice should be visible to a user
+- $notice: The notice to check
+- $profile: The profile to check for scope
+- &$bResult: The boolean result; fill this in if you want to skip
+
+EndNoticeInScope: After checking if a notice should be visible to a user
+- $notice: The notice to check
+- $profile: The profile to check for scope
+- &$bResult: The boolean result; overwrite this if you so desire
+
+
index 9ee5696e3f47a3cb68a8ccb79ca3422edcaccae4..9e4dbec9e33a6ec9fcc5bcddd46a06467212d6ae 100644 (file)
@@ -2365,7 +2365,11 @@ class Notice extends Managed_DataObject
         $result = self::cacheGet($keypart);
 
         if ($result === false) {
-            $bResult = $this->_inScope($profile);
+            $bResult = false;
+            if (Event::handle('StartNoticeInScope', array($notice, $profile, &$bResult))) {
+                $bResult = $this->_inScope($profile);
+                Event::handle('EndNoticeInScope', array($notice, $profile, &$bResult));
+            }
             $result = ($bResult) ? 1 : 0;
             self::cacheSet($keypart, $result, 0, 300);
         }