You'll need<br><br> global $Author;<br><br>at the top of any function in which you want to change the value of that global variable.<br><br>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...<br>
<br>-Peter<br><br><div class="gmail_quote">2009/3/30 Frank Schweickert <span dir="ltr"><<a href="mailto:f.schweickert@uva.nl">f.schweickert@uva.nl</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div bgcolor="#ffffff" text="#000000">
Thank you, Hans, this was the missing link: How to set up custom page
actions properly!<br>
- First question: Did I overlook this crucial information for recipe
authors on <a href="http://pmwiki.org" target="_blank">pmwiki.org</a> somewhere?<br>
<br>
So it works in principle! Only the author doesn't come out right in the
history.<br>
See <a href="http://www.natsim.net/ejswiki/Test/Page1" target="_blank">http://www.natsim.net/ejswiki/Test/Page1</a><br>
It would use the last name from the browser cookie, even if I set
$Author like below.<br>
(Unlike the "production site", my test installation hasn't got
restrictions for users as with scripts/authuser.php, author.php)<br>
<br>
$HandleActions['convert'] = 'HandleConvert';<br>
$HandleAuth['convert'] = 'frankobot2';<br>
<br>
function HandleConvert($pagename, $auth) {<div class="im"><br>
$old = RetrieveAuthPage('Test.Page1', 'read');<br></div>
if ($old) {<div class="im"><br>
$new = $old;<br>
$new['text'] = "x".$old['text'];<br>
$pn='Test.Page1';<br></div>
$oldAuthor = $Author;<br>
$Author='frankobot3';<br>
UpdatePage($pn,$old,$new);<br>
$Author=$oldAuthor;<br>
HandleBrowse($pagename);<br>
}<br>
}<br><font color="#888888">
<br>
Frank</font><div class="im"><br>
<br>
<br>
<br>
<br>
<br>
Hans wrote:
<blockquote type="cite">
<pre>Sunday, March 29, 2009, 10:43:08 PM, Frank wrote:
</pre>
<blockquote type="cite">
<pre> As to my understanding right now, UpdatePage is NOT a
function that is safe to be used directly in config.php includes.
</pre>
</blockquote>
<pre>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
</pre>
</blockquote>
<br>
<br>
</div><div class="im"><pre cols="72">--
_______________________________________________________________________
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-5866
<a href="http://www.science.uva.nl/amstel" target="_blank">http://www.science.uva.nl/amstel</a>
<a href="http://www.natsim.net" target="_blank">http://www.natsim.net</a></pre>
</div></div>
<br>_______________________________________________<br>
pmwiki-devel mailing list<br>
<a href="mailto:pmwiki-devel@pmichaud.com">pmwiki-devel@pmichaud.com</a><br>
<a href="http://www.pmichaud.com/mailman/listinfo/pmwiki-devel" target="_blank">http://www.pmichaud.com/mailman/listinfo/pmwiki-devel</a><br>
<br></blockquote></div><br>