Hello,
I' want to user userCan hook on every page, so I made an extension which
then calls this hook. I don't really know much about this hook so I need
some information.
How can I prevent access to users who are not logged in?
I tried with code bellow, but I get an empty page (wiki doesn't show):
# If user is logged in
if( !$wgUser->isLoggedIn() ) {
$wgOut->loginToUse();
return;
}
How is that with $action parameter? I only find 'edit', 'move'. What
about
'read' word, does it exist.
Everything must be done with this extension cos I don't want to change
mediaWiki files.
function efAdminPagesRestrictionsHook() {
global $wgHooks;
$wgHooks['userCan'][] = 'RestrictHookUserCan';
}
function RestrictHookUserCan( &$title, &$user, $action, &$result ) {
if( $action == 'edit' ) {
#code
}
if( $action == 'read' ) {
#code
}
if( $action == 'create' ) {
#code
}
}
Lp