I have been trying to make a button that password protects a page with
the editors' password, or un-protects it if it is already protected.
I tried putting this at the bottom of config.php, but it just seemed
to mess up my pages:
$HandleActions['switchauth'] = 'switchauth'; # if url contains
action=myaction call HandleMyAction timely
$HandleAuth['switchauth'] = ' '; # authorization level
$auth for HandleMyAction
function switchauth($pagename, $auth) { # parameters (signature)
of handler function required by PMWiki
# Lock(2);
$pagestuff = RetrieveAuthPage($pagename, 'attr', false);
$old=$pagestuff;
if($pagestuff['protected']==true){
$pagestuff['passwdread'] = 'test';
$pagestuff['protected']=false;
}
else{
$pagestuff['passwdread'] = 'test';
$pagestuff['protected']=true;
}
UpdatePage($pagename, $old, $pagestuff);
Redirect($pagename);
# Lock(0);
}
Can someone please help me?
Alex
_______________________________________________
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users