[pmwiki-devel] PostPage in recipe

Daniel Roesler diafygi at gmail.com
Mon Mar 30 06:38:01 CDT 2009


This is because you also need to set $AuthorLink to whatever you want.
It's actually kind of backwards, and I think it would be a good idea
to discuss the way this works. UpdatePage should include a check for a
new $AuthorLink based on $Author.

Avast!
Daniel Roesler
diafygi at gmail.com

On 3/30/09, Frank Schweickert <f.schweickert at uva.nl> wrote:
> 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-5866
> http://www.science.uva.nl/amstel
> http://www.natsim.net



More information about the pmwiki-devel mailing list