[pmwiki-users] recognizing read protection

Hans design5 at softflow.co.uk
Fri Jun 8 07:01:43 CDT 2007


Friday, June 8, 2007, 10:05:21 AM, Jabba Laci wrote:

> Most of the pages are public, but some of them are made private. These
> private pages have the following line in their source:
> name=<name_of_the_page>
> passwdread=<encrypted_password>                            # here!

> So what I want to catch is: if the page is read protected, i.e. if its
> source contains the line "passwdread=...", then do something (display
> a message for instance).

You may try this custom conditional:

add to config.php:

# custom conditional (:if pwread:)
$Conditions['pwread'] = 'IsPWRead($pagename)';
function IsPWRead($pagename) {
   $page = RetrieveAuthPage($pagename, 'read', false, READPAGE_CURRENT);
   if($page["passwdread"]) return true;
   else return false;
}


Use in wiki page:

(:if pwread:)Page is read protected(:if:)


  ~Hans




More information about the pmwiki-users mailing list