Extension:FlaggedRevs/Restricting unapproved revisions

This page describes how to only give read access to the stable versions of articles to anonymous users for MediaWiki 1.17+.

Basic idea
This approach works as follows: The details to do this are described in the next few sections.
 * (i) Make all pages unreadable and uneditable by non-users (that is, readable only for users)
 * (ii) But make the stable version of pages an exception in that they are readable to non-users

Making the site readable only by users
See Manual:Preventing_access and Manual:Preventing_access

Add these lines to your LocalSettings.php file:

Adding stable version as exemption for non-users
Add the following to LocalSettings.php: You can set  to make all talk pages viewable to non-users.

is an array of user groups. It doesn't have to just be '*'. Setting it to  will let all visitors be able to see the stable version of pages. Setting it to  will make the stable versions visible to users in the group 'supergroup'.

You also don't have to use these global variables and can just hard code whatever is needed into the efFlaggedRevsHooks_userCanView function mentioned below.

Add the following code to localsettings.php (or an appropriate custom start-up config file): ...and then define the following function: If you are using MediaWiki 1.18+, then replace  with. You can also remove the  variable and the   check.

Caveats

 * This does not work well with img_auth.php, as non-user viewers will not be able to see images. You will probably just want to leave images public but under hashed directories to make them harder to find. This is acceptable if there are no private files and the main concern is just not to release unverified content.
 * This will probably be useless without having.
 * Make sure that  is set properly. You will at least want something like  . You may also want visible directory or category pages. Otherwise, the wiki will be hard to browse for readers.
 * Use  to allow viewing of all talk pages by these users.
 * You will probably want to edit MediaWiki:loginreqpagetext to make it more detailed. It will come up in various situations and thus should explain the approval system setup.