Page 1 of 1

Guestbook Plugin V: 1.2

Posted: Thu Feb 03, 2005 6:40 pm
by boelkstoff
Hello.
Since no guestbook plugin is available, i decided to write my own plugin.
I have tested it in the alpha version 0.8.
The basic is done, it would be nice if someone could help out with the design, because I am not a good webdesigner :-)
Also testing would be good.

Code: Select all

removed because old version! newest version in cvs

Posted: Thu Feb 03, 2005 6:43 pm
by boelkstoff
One big error is still in.

After saving an entry it is saved twice and I dont know why.

Can somebody help me??
I could uncomment the session-lock. But that means that people can only write once into the guestbook and I dont wont that.

HELP NEEDED!!

Phil

Posted: Thu Feb 03, 2005 9:38 pm
by garvinhicking
Thanks for contributing, this looks like a nice plugin. Would you like to contribute this to CVS? You would just need to clean up some codestyle issues (right indentation) and then you could maintain it there, if you like. (If yes, send me a mail with your SourceForge.net username and I will setup the CVS karma for you)

About the double insert: It seems to be you are calling $this->show() multiple times, so the "insert" action is called more than once.

Currently I am on very limited time so I can't look into it at the moment. I'll try to do that the next days, if you can't fix it by yourself already.

Looking forward to putting your plugin in our repository! :)

Regards,
Garvin

Posted: Thu Feb 03, 2005 10:08 pm
by boelkstoff
Hello Garvin,

yes I can contribute this to CVS, but not at the moment, because everything is still beta.
I also want a better design, before I put it into cvs.

To be honest I did not wrote the event_hook funktion. I copied it from another event plugin. I have no idea what is going on in this section, since there is no good doku for that.

Can anybody tell me what the event_hook function is doing here exactly?

Thank you

Posted: Fri Feb 04, 2005 10:44 am
by garvinhicking
Hi boelkstuff!

Okay, if you get it in "out-of-beta" state, please just contact me and I'd really like to put it into CVS!

About the event hooks: Have you read http://www.s9y.org/43.html#A30 ? I think it'S described there...the short summary is this:

When an event (like 'frontend_display') is triggered within the Serendipity stuff, all plugins are cycled and be checked if they want to perform actions on that trigger. If they do, the event_hook() method is executed. It gets passed the event hook name and input Data: $eventData and $addData. What is in those arrays always depends on the event type that is executed. 'Frontend_display' for example contains the $entry array as $eventData. $eventData is passed by reference and its data can be modified, while $addData contains additional data which cannot be modified.

Inside the event_hook method, the plugin can modify data as it likes, and after execution the usual Serendipity workflow continues.

HTH,
Garvin

Posted: Fri Feb 04, 2005 11:30 am
by boelkstoff
hello garvin,

ok think I get an idea what the hooks are doing.

But I still have the problem with the double entries.
I dont know what I am doing wrong.
Maybe one developer can take a look at it.


Thanks
Phil

Posted: Fri Feb 04, 2005 1:32 pm
by garvinhicking
Phil,

maybe you can add some debugging on your own. I suppose that the generate_content() method is called twice.

Just create something like this at the beginning of that method:

Code: Select all

$fp = fopen('debug.log', 'a');
fwrite($fp, "Plugin method generate_content() has been called. Input values are: \n" . print_r(func_get_args(), true) .  "\n);
fclose($fp);
Then you create the page and look into your debug.log logfile and see why/when the method was called twice. Maybe some plugin introspection hooks call 'generate_content' earlier on...

I'd dore more debugging for you, but as I said I'm a bit short of time for that :(

Regards,
Garvin

Posted: Fri Feb 04, 2005 2:06 pm
by boelkstoff
WOW,
I insert your code and modified it.
I did not use the print_r(func_get_args() funktion I just used the tim() funktio n.
And it looks like the funktion is called 4x when I do an insert.

Maybe some other developer can help me out here PLEASE.

Thanks
Phil

Posted: Fri Feb 04, 2005 3:43 pm
by garvinhicking
Okay, I looked into it.

You need to put your main code outside of generate_content() and inside its own method.

Because Serendipity executes the generate_content() method when querying for the plugin title.

Inside generate_content() for Event plugins you should only do stuff to the $title variable that is needed to get the title. Put everything else into a seperate method which is only called by your $this->show() code.

Then it will only be called once. Actually the static page plugin does it wrong as well, but there it's not doing evil because it's only echoing stuff and not doing database inserts.

Regards,
Garvin

New Version 1.1

Posted: Fri Feb 04, 2005 6:36 pm
by boelkstoff
Thanks that solved the problem.
I still dont know how to set the title of the html page from my plugin.
Solved that problem now (version 1.101 )!

But I worked today on the plugin:
here now the featurs
  • - integrate in the s9y style (like comments)
    - new .error style for error messages
    - session lock (one entry per session)
    - time look (one entry per time, e.g. one entry every 10sec
    - same url as other staticpages
    - custom number of entries per page
    - for use in 0.8 and only testet in an alpha version of 0.8 !!!
So here is the code and YES you can put it into CVS now.

Code: Select all

removed newest version in CVS

Posted: Fri Feb 04, 2005 10:33 pm
by boelkstoff
Post in my guestbook (with Email) and you will get email when a new version is out :D

Posted: Sun Mar 20, 2005 7:38 pm
by Trench
Supid question time.

What is the URL to my guestbook suppoed to be.

Posted: Tue Mar 22, 2005 6:04 pm
by SILU
Hi, i want to use the guestbook, downloaded the php-file from CVS and put into the directory plugins/serendipity_event_guestbook/serendipity_event_guestbook.php - but then i get an error @ the admin-center @ plugins:
Parse error: parse error in /var/www/web96/html/serendipity/plugins/serendipity_event_guestbook/serendipity_event_guestbook.php on line 37
Fehler: serendipity_event_guestbook
What to do ? thx, SILU

Posted: Wed Mar 23, 2005 12:43 pm
by garvinhicking
SILU, it seems you did not download the plugin correctly. Check it out from CVS or download it properly, or download the full mirror padditional_plugins file at http://www.netmirror.org/mirror/serendipity/.

Regards,
Garvin