Extension talk:PrivatePageProtection

About this board

Error: LoadBalancer.php: Invalid server index index #DB_SLAVE

Oldmobilix (talkcontribs)

The constant DB_SLAVE, deprecated in 1.28, has been removed. Use DB_REPLICA.


$dbr = wfGetDB( DB_SLAVE );        # OLD

$dbr = wfGetDB( DB_REPLICA );      # NEW

Reply to "Error: LoadBalancer.php: Invalid server index index #DB_SLAVE"

VisualEditor and PrivatePageProtection

Summary by AdamLacey

it resolved it self

AdamLacey (talkcontribs)

Hi All,

I'm not a php developer and I know this extension is no longer maintained but I was wondering if anyone knew how to use the allow-group to protect a page that only 1 group of users can see (e.g. using "#allow-groups:mycustomgroup" at the top of a page) and still have visual editor work on this page? The Parsoid user that runs VisualEditor is a member of all the groups in existence and I know it's this thats restricting the page as when I remove the "#allow-groups:mycustomgroup" it works.

Many thanks in Advance

AdamLacey (talkcontribs)

This has strangely resolved it self now (talkcontribs)

Open PrivatePageProtection.php

under the function:

  function privateppGetAccessError( $groups, $user ) {

under line 115:

  if ( is_string( $groups ) ) $groups = explode('|', $groups);


  if(! is_string( $groups ) && strpos($groups[0], '|') !== false)  $groups = explode('|', $groups[0]);

then the extension works fine. (talkcontribs)

Awesome, worked. Cheers

Reply to "Bug Resolved"

PageContentSave instead of ArticleSave and Store groups at once

1 (talkcontribs)

I'm about to remove obsolete ArticleSave-hook an replace it with PageContentSave, but got two problems:

  • I find no way to get a ParserOutput() of the Page before it is saved, so I eed to parse the content right here.
  • After the article is saved, the page_props-table is not updated. I thought setProperty would do the job, but that does not work. So I had to write the info by hand.
$wgHooks['PageContentSave'][] = 'privateppPageContentSave';


function privateppPageContentSave( $wikiPage, $user, $content, $summary, $isMinor, $isWatch, $section, $flags, $status)
        # prevent users from saving a page with access restrictions that
        # would lock them out of the page.

        $text = $content->getNativeData();

#XXX: calling prepareTextForEdit() causes the text to be parsed, because it is not parsed
#     yet:  groups is empty
#       $parserOutput=$article->getParserOutput();
#       $groups = $parserOutput->getProperty('ppp_allowed_groups');

        $editInfo = $article->prepareTextForEdit( $text, null, $user );
        $groups = $editInfo->output->getProperty('ppp_allowed_groups');

        $err = privateppGetAccessError( $groups, $user );
        if ( $err ) {
                return false;

#XXX does not store the groups into page_props
#        $editInfo->output->setProperty('ppp_allowed_groups', $groups);

        /* set */
        $row = [ 'pp_value'      => $groups ];
        /* where */
        $conditions = [ 'pp_page' => $wikiPage->getId(),
                        'pp_propname' => 'ppp_allowed_groups' ];

        $dbw = wfGetDB( DB_MASTER );

        if(!isset($groups) || strlen($groups) == 0 ) {
                $dbw->delete( 'page_props', $conditions, __METHOD__ );
        } else {
                $dbw->update( 'page_props', $row, $conditions, __METHOD__ );
                        if($result = $dbw->affectedRows() < 1) {
                        $row = [ 'pp_page' => $wikiPage->getId(),
                                 'pp_propname' => 'ppp_allowed_groups',
                                 'pp_value'      => $groups ] ;
                        $dbw->insert( 'page_props', $row, __METHOD__, 'IGNORE' );

        return true;

Reply to "PageContentSave instead of ArticleSave and Store groups at once"
DikkieDick (talkcontribs)

Hi, I have 2 groups which might have access to specific pages but I can't get it to work.

If I enter


when logged on as the Admin-user who also belongs to the Trusted group after saving the page I get:

You do not have permission to edit this page, for the following reason:


Same when I use

{{#allow-groups:sysop}} or {{#allow-groups:sysop|Trusted}}

Mitchelln (talkcontribs)


It appears you cannot capitalize the user group. If you change it to "trusted" then it will work. In fact, if there are capitals anywhere, the entire statement seems to fail.

You also need to apply the patch listed a few posts below.

DikkieDick (talkcontribs)

Just seeing this now, but a 'long time ago' we opted for the accesscontrol-plugin.

Reply to "Doesn't seem to work" (talkcontribs)

Can't find snapshot on provided link.

Is there any change in name or this extension is just removed from mediawiki repo?

Kghbln (talkcontribs)

For some reason this extension has not been migrated to the new Git repository. I guess it may probably now be regarded as unmaintained. Thus no snapshot is available. However you can download the files from SVN. Cheers

Reply to "Can't find snapshot." (talkcontribs)

Hi. I followed the installation instructions. PrivatePageProtection is shown under the Special Pages:Version section.

This is the test I made:

Users: User A: administrator User B: non-administrator

I created a page and added: {{#allow-groups:sysop}}

User B can still access the page. Not sure what I'm doing wrong here..

I also created a new group called group1 by adding this line to LocalSettins.php:

wgGroupPermissions['group1']['read'] = false;

I added User A to group1, and then tried to restrict access to the page by including:


However, I can't even save the page.. seems like the extension doesn't recognize this custom-made group.

Please help.


Till Kraemer (talkcontribs)

Hi, I think it should be wgGroupPermissions['group1']['read'] = true;. Cheers,

Reply to "Extension not working"

Suggestion: information about restriction in footer (or similar)

1 (talkcontribs)


what do you think about an information in the footer, telling me the allowed groups permanently? Currently I have to edit the page each time, to find out the allowed groups. It will be great, if you can show it for example in the footer or elsewhere. Perhaps you can tell me, how to get it.

Thank you!

Reply to "Suggestion: information about restriction in footer (or similar)"

Wrong vartype on db result

1 (talkcontribs)

Hello Duesentrieb,

there is a bug in your actual code. The db result from privateppGetAllowedGroups returns as an array, but the calling methods expect a string. After fixing this problem (return $result[0] instead of return $result), the extension runs fine.

Reply to "Wrong vartype on db result"
Coffeehound (talkcontribs)

Ver: MW 1.18.1 OS: Windows and Linux

It doesn't work. You can goto https://offgridops.org/foreclosurepedia/index.php/A2ZFS to better understand. In the view source it posts:


You do not have permission to edit this page, for the following reasons: The action you have requested is limited to users in one of the groups: Users, fcpd. The action you have requested is limited to users in the group: fcpd.

Yes, I set the group up:

$wgGroupPermissions['fcpd']['move'] = true; $wgGroupPermissions['fcpd']['move-subpages'] = true; $wgGroupPermissions['fcpd']['move-rootuserpages'] = true; // can move root userpages //$wgGroupPermissions['user']['movefile'] = true; // Disabled for now due to possible bugs and security concerns $wgGroupPermissions['fcpd']['read'] = true; $wgGroupPermissions['fcpd']['edit'] = true; $wgGroupPermissions['fcpd']['createpage'] = true; $wgGroupPermissions['fcpd']['createtalk'] = true; $wgGroupPermissions['fcpd']['writeapi'] = true; $wgGroupPermissions['fcpd']['upload'] = true; $wgGroupPermissions['fcpd']['reupload'] = true; $wgGroupPermissions['fcpd']['reupload-shared'] = true; $wgGroupPermissions['fcpd']['minoredit'] = true; $wgGroupPermissions['fcpd']['purge'] = true; // can use ?action=purge without clicking "ok" $wgGroupPermissions['fcpd']['sendemail'] = true;

Reply to "Doesn't Work"
There are no older topics