Page 1 of 1
Feature/Sticky Comments?
Posted: Wed Jul 13, 2005 9:26 pm
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
Re: Feature/Sticky Comments?
Posted: Thu Jul 14, 2005 12:44 pm
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
Thanks!
Posted: Thu Jul 14, 2005 10:38 pm
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...
Re: Thanks!
Posted: Thu Jul 14, 2005 11:27 pm
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