From aa4f7f8ac1974bd46a9754ad32f4508d6063bd3e Mon Sep 17 00:00:00 2001 From: Rob Church Date: Sun, 5 Feb 2006 18:47:40 +0000 Subject: [PATCH] (bug 4860) Expose Title->userCan() as Hooks --- RELEASE-NOTES | 1 + includes/Title.php | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index c8add109d7..4c1f949f3d 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -598,6 +598,7 @@ fully support the editing toolbar, but was found to be too confusing. * Reset $wgActionPaths during parser test; corrects some false failures in the automated test report. * (bug 4875) Define a div containing the shared image description +* (bug 4860) Expose Title->userCan() as Hooks === Caveats === diff --git a/includes/Title.php b/includes/Title.php index 4cbaa14908..4cfce2b831 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -927,6 +927,13 @@ class Title { wfProfileIn( $fname ); global $wgUser; + + $result = true; + if ( !wfRunHooks( 'userCan', array( &$this, &$wgUser, $action, &$result ) ) ) { + wfProfileOut( $fname ); + return $result; + } + if( NS_SPECIAL == $this->mNamespace ) { wfProfileOut( $fname ); return false; @@ -1030,6 +1037,11 @@ class Title { function userCanRead() { global $wgUser; + $result = true; + if ( !wfRunHooks( 'userCan', array( &$this, &$wgUser, "read", &$result ) ) ) { + return $result; + } + if( $wgUser->isAllowed('read') ) { return true; } else { -- 2.20.1