Extension talk:PageSecurity/PageSecurity.php
Latest comment: 17 years ago by Fernando.correia in topic Hook chaining?
Use this page to submit source code changes (patches).
Use the extension discussion page for general feedback.
Hook chaining?[edit]
Hi!
On my installation of MediaWiki I have multiple extensions using the "userCan"-Hook. I had to change the code of this extension as follows:
// Handles the userCan event. // $result = false if the $user is not allowed to execute $action on $title. function fnPageSecurityUserCanHook($title, $user, $action, $result) { - if (!SecurityManager::userCan($title, $user, $action)) $result = false; + if (!SecurityManager::userCan($title, $user, $action)) { + $result = false; + return false; + } else { + return true; + } }
With that change the other hooks get called if the user has permission to execute the current action. For me this works - but is it the standard way to chain hooks? If yes, this patch might be worth to be included in the main source. - 141.41.137.2 11:42, 22 February 2007 (UTC)
- You're probably right. I'll look into it. Thanks. --Fernando Correia 12:09, 22 February 2007 (UTC)