Jump to content

User talk:Barrylb/Usercan Hook

Add topic
From Meta, a Wikimedia project coordination wiki
Latest comment: 17 years ago by Barrylb

Limit non-logged-in users to editing talk pages only

Doesn't seem to work for me on version 1.7.1 - I am adding the function and the $wgHooks statement to the end of the LocalSettings.php but after that all access to the wiki seems disabled (just get a blank page)

Anyone else experience this or know a workaround?

I haven't tried 1.7.1 but I can't see why that would happen. Does it go back to normal when you remove the hook? -- Barrylb 12:24, 27 July 2006 (UTC)Reply

Thanks a lot for your help.

Yes - when I remove the hook it goes back to normal. Apart from putting the hook in it is a clean new installation of the wiki. The hook is right at the end of the LocalSettings.php but before the ?> as below. Perhaps I am making some obvious mistake, I am not so familiar with php..

$wgGroupPermissions['*']['createaccount'] = false;
$wgLogo = "http://www.odonline.com/images/logo_square_small.gif"

function fnMyUserCan($title, $user, $action, $result)
        if ($action == 'edit')
                if (!$title->isTalkPage() && !$user->isLoggedIn())
                        $result = false;

$wgHooks['userCan'][] = 'fnMyUserCan';


Yes obvious mistake! You need a semicolon at the end of the $wgLogo line! Hope that help. -- Barrylb 05:27, 28 July 2006 (UTC)Reply