* (bug 11574) Add an interface message loginstart, which, similarly to loginend,
appears just before the login form. Patch by MinuteElectron.
* Do not cache category pages if using 'from' or 'until'
+* Created new hook getUserPermissionsErrors, to go with my userCan changes from ages ago.
=== API changes in 1.12 ===
$url: string value as output (out parameter, can modify)
$query: query options passed to Title::getFullURL()
+'getUserPermissionsErrors': Add a permissions error when permissions errors are checked for.
+ Use instead of userCan for most cases. Return false if the user can't do it,
+ and populate $result with the reason in the form of array( messagename, param1, param2 )
+$title: Title object being checked against
+$user : Current user object
+$action: Action being checked
+$result: User permissions error to add. If none, return true.
+
'ImageOpenShowImageInlineBefore': Call potential extension just before showing the image on an image page
$imagePage: ImagePage object ($this)
$output: $wgOut
'UploadComplete': Upon completion of a file upload
$image: Image object representing the file that was uploaded
-'UserCan': To interrupt/advise the "user can do X to Y article" check
+'UserCan': To interrupt/advise the "user can do X to Y article" check.
+ If you want to display an error message, try getUserPermissionsErrors.
$title: Title object being checked against
$user : Current user object
$action: Action being checked
$result: Pointer to result returned if hook returns false. If null is returned,
- UserCan checks are continued by internal code
+ UserCan checks are continued by internal code.
'UserCreateForm': change to manipulate the login form
$template: SimpleTemplate instance for the form
$errors = array();
+ // Use getUserPermissionsErrors instead
if ( !wfRunHooks( 'userCan', array( &$this, &$user, $action, &$result ) ) ) {
return $result ? array() : array( array( 'badaccess-group0' ) );
}
+ if (!wfRunHooks( 'getUserPermissionsErrors', array( &$this, &$user, $action, &$result ) ) ) {
+ if ($result != array() && is_array($result) && !is_array($result[0]))
+ $errors[] = $result; # A single array representing an error
+ else if (is_array($result) && is_array($result([0])))
+ $errors = array_merge( $errors, $result ); # A nested array representing multiple errors
+ else if ($result != '' && $result != null && $result !== true && $result !== false)
+ $errors[] = array($result); # A string representing a message-id
+ else if ($result === false )
+ $errors[] = array('badaccess-group0'); # a generic "We don't want them to do that"
+ }
+
if( NS_SPECIAL == $this->mNamespace ) {
$errors[] = array('ns-specialprotected');
}