Feature/Sticky Comments?

Creating and modifying plugins.
Post Reply
keith
Posts: 2
Joined: Wed Jul 13, 2005 9:02 pm

Feature/Sticky Comments?

Post by keith »

Hi everyone! I am fairly new to Serendipity and so far I absolutely love it. Implementation and execution is awesome.

Question for the community --

I have a client who is looking for a way to toggle the display of comments on their blog. For example, there would be two views: Comments we want featured and ALL comments.

Does anyone know of a way to do this?

Thanky,

--Keith
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Feature/Sticky Comments?

Post by garvinhicking »

This could be done by creating a plugin (maybe also inject 1-2 lines of event hooks into the code) and adjusting the comments.tpl template.

So the best thing is to look into the include/functions_comments.inc.php file, especially the function serendipity_printComments(). Tthe hook frontend_display could be used for deploying a link for an admin to mark a comment as 'featured'. You'd need an extra DB column for the "comments" table then, though.

And then look at templates/default/comments.tpl where you could highlight those comments appropriately.

Creating a sidebar plugin like serendipity_plugin_comments which only reads the comments having "featured == true" would then be very easy.

I hope that helps you for an idea. If you do implement this, I would love to include the neccessary patches to the core files and add your plugin(s) to our code?

I think you won't get around changing the printComments() function and at least adding a serendipity_comments.is_featured DB table column...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
keith
Posts: 2
Joined: Wed Jul 13, 2005 9:02 pm

Thanks!

Post by keith »

Thank you for getting me started, Garvin. I have made significant progress getting the "feature" feature (redundant, I know) set up. However, I am having a small problem with the status after a Feature is toggled.

After it is set, I am trying to get it to tell the user that it is done, or, COMMENT #x FEATURE HAS BEEN SET TO [1 or 0]

Again, thank you tons for your help! I would love to send this to you, if I can remember what I did...
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Thanks!

Post by garvinhicking »

You could emit this info via JavaScript, emitted on the frontend_header hook or someplace else...?

And for finding the modifications, have a look at SVN tools and patch/diff. Then you can easily diff the changes you have made:)

You should definitely keep track of your changes, because when you needto upgrade Serendipity (because of bugs or whatever) you'll not want to lose your changes:)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply