You'll need global $Author;
at the top of any function in which you want to change the value of that global variable. I add my thanks to Hans on this explanation for custom actions. If it's somewhere in the docs I've never seen it -- very nice feature & easy to implement... -Peter 2009/3/30 Frank Schweickert <f.schweick...@uva.nl> > Thank you, Hans, this was the missing link: How to set up custom page > actions properly! > - First question: Did I overlook this crucial information for recipe > authors on pmwiki.org somewhere? > > So it works in principle! Only the author doesn't come out right in the > history. > See http://www.natsim.net/ejswiki/Test/Page1 > It would use the last name from the browser cookie, even if I set $Author > like below. > (Unlike the "production site", my test installation hasn't got restrictions > for users as with scripts/authuser.php, author.php) > > $HandleActions['convert'] = 'HandleConvert'; > $HandleAuth['convert'] = 'frankobot2'; > > function HandleConvert($pagename, $auth) { > $old = RetrieveAuthPage('Test.Page1', 'read'); > if ($old) { > $new = $old; > $new['text'] = "x".$old['text']; > $pn='Test.Page1'; > $oldAuthor = $Author; > $Author='frankobot3'; > UpdatePage($pn,$old,$new); > $Author=$oldAuthor; > HandleBrowse($pagename); > } > } > > Frank > > > > > > Hans wrote: > > Sunday, March 29, 2009, 10:43:08 PM, Frank wrote: > > > > As to my understanding right now, UpdatePage is NOT a > function that is safe to be used directly in config.php includes. > > > but you don't need to. > You can create an action 'ejselements' > and have everything in one function HandleFrankobot(), which > gets called with ?action=ejselements from the url, or from a > link somewhere on a site admin page perhaps. > > $HandleActions['ejselements'] = 'HandleFrankobot'; > > $HandleAuth['ejselements'] = 'admin'; > > function HandleFrankobot($pagename, $auth) { > > ..... > UpdatePage(.........); > .... > HandleBrowse($pagename); > } > > > Hans > > > > > > > -- > _______________________________________________________________________ > Dr. Frank F. Schweickert > AMSTEL Institute, Faculty of Science, University of Amsterdam > Kruislaan 404, Amsterdam, 1098 SM, Netherlands > Room 1.09 > Phone: +31 20 525-5969, Fax: +31 20 > 525-5866http://www.science.uva.nl/amstelhttp://www.natsim.net > > > _______________________________________________ > pmwiki-devel mailing list > pmwiki-devel@pmichaud.com > http://www.pmichaud.com/mailman/listinfo/pmwiki-devel > >
_______________________________________________ pmwiki-devel mailing list pmwiki-devel@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-devel