User:Barrylb/Usercan Hook

You can restrict access to certain MediaWiki features without modifying the core files using the userCan hook available since version 1.6.0. Tested and working on version 1.6.7 and 1.7.1.

Note the 'userCan' hook for 'edit' actions acts in addition to any other security checks so if you have this  in your LocalSettings.php then it will act in addition, and disable anonymous editing entirely.

Put one the following in your LocalSettings.php file depending on your needs:

Limit non-logged-in users to editing talk pages only
Later versions require that you return true or false. Refer to userCan hook for more details. So, I had to modify the above code to return a value. In addtion, you need to make sure that the other users (loggedIn) are able to edit any page and the notLoggedIn not able to edit pages just talks. The updated code is as follows:

Non-logged-in users can view source but not edit
Last change 21:54, 16 September 2008 (UTC)