[pmwiki-users] setting page attibute acording a publish/drafts ptv

Hans design5 at softflow.co.uk
Thu Nov 27 08:07:14 CST 2008

Thursday, November 27, 2008, 1:25:30 PM, noskule wrote:

> ok I try that, is there an example somwhere how to change attributes of pages
> in php?

I have no time to create a function, but here
under "Creating a Profile page and Preferences page"
you find a filter script which sets an edit password.

$new['passwdread'] = crypt(read_password');

might do the trick.


# set read password "read_password" on target pages
$FoxFilterFunctions['FoxSetReadPW'] = 'FoxSetReadPW';
function FoxSetReadPW($pn, $fields) {
   global $FoxAuth, $AuthId, $Author;
       $targets = preg_split("/[\s,|]+/", $fields['target'], -1, PREG_SPLIT_NO_EMPTY);
   else return;
   foreach ($targets as $tgt) { 
            $pn = MakePageName($pn, $fields['foxgroup'].".".$tgt);
       else $pn = MakePageName($pn, $tgt);

       $page = RetrieveAuthPage($pn, $FoxAuth, true);
       if (!$page) echo "?cannot edit $pagename";
       $new = $page;
       if ($new['text'] =="") $new['text'] = " ";
        if ($AuthId) $new['passwdread'] = crypt('read_password');
       UpdatePage($pn, $page, $new);
   return $fields;


More information about the pmwiki-users mailing list