[Pmwiki-users] Password protection

Patrick R. Michaud pmichaud
Fri May 14 12:17:58 CDT 2004


On Fri, May 14, 2004 at 10:04:57AM -0600, *** Dave Hill wrote:
> >
> >    $page = ReadPage($pagename);
> >    if (isset($page['passwdread'])) $PageHasReadPassword = 'readpw set';
> >    if (isset($page['passwdedit'])) $PageHasEditPassword = 'editpw set';
> >
> 
> I'm clearly doing something wrong here, since I cut-n-pasted the above into my
> config.php, then put the variables into my template, only to have the
> variables show up like any text (i.e., the "$PageHasReadPassword" text shows
> up, not the value).

Woops, my fault entirely!  Add two additional lines to initialize the variables
in case a password is *not* set:

   $PageHasReadPassword = '';
   $PageHasEditPassword = '';
   $page = ReadPage($pagename);
   if (isset($page['passwdread'])) $PageHasReadPassword = 'readpw set';
   if (isset($page['passwdedit'])) $PageHasEditPassword = 'editpw set';

Pm



More information about the pmwiki-users mailing list