Filter hook to selectively show comments for a post

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Filter hook to selectively show comments for a post

Korey Atterberry
Hi all-

  First of all, I'm new to this mailing list and I apologize if I
shouldn't be posting here.  I'm looking forward to contributing to the
Wordpress world a little bit by improving a plugin of mine, but I need
a little push in the right direction.  I didn't hear anything from the
general population on the Wordpress support forum, but if there's a
more appropriate resource I would appreciate the suggestion.

  What I want to know is, is there a filter or action hook somewhere
that I could use to selectively display comments on a given post?  

  In my Lazy-K Gallery plugin (htpp://plugins.atterberry.net), I host
an image gallery in one Wordpress Page.  The gallery plugin looks at
the "file" parameter in the query string to determine what image or
folder to display.  My users want to be able to comment individually on
each image.  What I figured I'd do is when a users posts a comment,
insert the image name into the text of the comment (since every image's
comments will be stored under one Page) prior to saving the comment
into the db.  When I display my page, including all the comments, I
would then look at the text of each comment and determine whether it
applies to the image currently being shown.  I haven't found a hook for
that just yet.  I found hooks to let me edit the content, author, etc.,
but not to remove a comment altogether.

Thanks in advance for any direction.  By the way, thanks for all the
work you have done on Wordpress.

Korey Atterberry

_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Filter hook to selectively show comments for a post

Paul Mitchell-3
Korey,

I'd start in your theme's "comments.php". You have $comments and a
foreach loop to play with. You can directly filter comments by content
there.

--
Paul Mitchell, Coding and Crafting Quality Software
http://www.libertini.net/libertus/category/software/


_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Filter hook to selectively show comments for a post

Korey Atterberry

Thanks for the reply Paul, but I'm trying to accomplish this completely
inside a plugin so that it will work with any user's theme.  That's why
it's frustrating- all I have to do is tell my users to add a line or
two of code to their comments template to filter that array and we're
done.  I'm looking for a more portable solution though...  I was hoping
there was a hook that I hadn't found that would allow me to modify that
array.  

Korey


--- Paul Mitchell <[hidden email]> wrote:

> Korey,
>
> I'd start in your theme's "comments.php". You have $comments and a
> foreach loop to play with. You can directly filter comments by
> content
> there.
 

_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Filter hook to selectively show comments for a post

Paul Mitchell-3
Korey Atterberry wrote:
> Thanks for the reply Paul, but I'm trying to accomplish this completely
> inside a plugin so that it will work with any user's theme.

The WP comment template code
(wp-includes/comment-functions.php/comments_template) doesn't offer any
way for a plugin to filter the comments. Some participation from the
theme is necessary.

Paul

_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Filter hook to selectively show comments for a post

Korey Atterberry
Ok, thanks for the confirmation, Paul.  I'll try that approach.  I
could probably get by asking my users to add just one line to their
comment template.

Korey

--- Paul Mitchell <[hidden email]> wrote:

> The WP comment template code
> (wp-includes/comment-functions.php/comments_template) doesn't offer
> any
> way for a plugin to filter the comments. Some participation from the
> theme is necessary.

_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Filter hook to selectively show comments for a post

David House
On 19/04/06, Korey Atterberry <[hidden email]> wrote:
> Ok, thanks for the confirmation, Paul.  I'll try that approach.  I
> could probably get by asking my users to add just one line to their
> comment template.

Feel free to request a new filter for inclusion in the next version:
http://trac.wordpress.org/newticket

--
-David House, [hidden email], http://xmouse.ithium.net
_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Filter hook to selectively show comments for a post

Paul Mitchell-3
David House wrote:
> Feel free to request a new filter for inclusion in the next version:
> http://trac.wordpress.org/newticket
Thanks David. I didn't know how to say that!

Paul

_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Filter hook to selectively show comments for a post

Korey Atterberry
In reply to this post by David House
Thanks, David and Paul.  I was looking for the enhancement request
system.  I'll submit that request.  I think it would be a handy
addition (at least for me!)

Korey

--- David House <[hidden email]> wrote:

> On 19/04/06, Korey Atterberry <[hidden email]> wrote:
> > Ok, thanks for the confirmation, Paul.  I'll try that approach.  I
> > could probably get by asking my users to add just one line to their
> > comment template.
>
> Feel free to request a new filter for inclusion in the next version:
> http://trac.wordpress.org/newticket
>
> --
> -David House, [hidden email], http://xmouse.ithium.net
> _______________________________________________
> wp-hackers mailing list
> [hidden email]
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>

_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Loading...