* Sylvain Leroux <sylv...@chicoree.fr> [Sat, 23 Jan 2010 20:01:02 +0100]: > Thanks Dmitriy. > > By looking at the code of Title::userCanReed, I noticed the 'userCan' > hook that > appears to be here for that exact purpose. > > http://www.mediawiki.org/wiki/Manual:Hooks/userCan > > I think I will use it with a custom extension to filter pages by title. > I had some trouble for 'userCan' not always being called, so my (still unpublished) extension uses both 'userCan' and 'userGetRights' hooks:
# called as the 'UserGetRights' hook to allow user to delete his own page and the subpages of that page static function checkUserPageDelete( &$user, &$aRights ) { global $wgTitle; # enable the deletion of user's page and his subpages if ( self::validLocalTitle( $wgTitle, NS_USER ) ) { $user_name_pq = preg_quote( $user->getName(), '`' ); $title_str = $wgTitle->getText(); if ( preg_match( '`^(' . $user_name_pq . '|' . $user_name_pq . '/.*)$`u', $title_str ) ) { self::addRight( 'delete', $aRights ); } } return true; } Try 'userCan' first - after all that's an officially recommended way. Probably should be enough for page filtering. Dmitriy _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l