<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body 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 pmwiki.org somewhere?<br>
<br>
So it works in principle! Only the author doesn't come out right in the
history.<br>
See <a class="moz-txt-link-freetext" href="http://www.natsim.net/ejswiki/Test/Page1">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) {<br>
$old = RetrieveAuthPage('Test.Page1', 'read');<br>
if ($old) {<br>
$new = $old;<br>
$new['text'] = "x".$old['text'];<br>
$pn='Test.Page1';<br>
$oldAuthor = $Author;<br>
$Author='frankobot3';<br>
UpdatePage($pn,$old,$new);<br>
$Author=$oldAuthor;<br>
HandleBrowse($pagename);<br>
}<br>
}<br>
<br>
Frank<br>
<br>
<br>
<br>
<br>
<br>
Hans wrote:
<blockquote cite="mid:1597469939.20090330002350@softflow.co.uk"
type="cite">
<pre wrap="">Sunday, March 29, 2009, 10:43:08 PM, Frank wrote:
</pre>
<blockquote type="cite">
<pre wrap=""> 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 wrap=""><!---->
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>
<pre class="moz-signature" 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 class="moz-txt-link-freetext" href="http://www.science.uva.nl/amstel">http://www.science.uva.nl/amstel</a>
<a class="moz-txt-link-freetext" href="http://www.natsim.net">http://www.natsim.net</a></pre>
</body>
</html>