[wp-hackers] Hooking into Comments
David House
dmhouse at gmail.com
Sun Aug 21 14:50:51 GMT 2005
On 20/08/05, gallery.manager at hiveworks.com
<gallery.manager at hiveworks.com> wrote:
> I had a look at the WP code but I couldn't find any way to hook into
> comments. They seem to be hardwired to posts.
I did this for one of my sites, apiakp.co.uk. I actually used a
seperate table but my initial plan was just to use the wp_comments
table. The way to do it is to pick a ridiculously large number which
you could never expect to arrive as a post ID, say 1,000,000. Create a
form for the creation of a comment that posts to either
wp-comments-post.php or a stripped down version which you can create
(I went for the latter as the former just seemed to generate too many
problems). Store the comments with a comment_post_ID of your really
big number. Finally, when it comes to viewing the comments, just
select all the comments with a comment_post_ID of your really high
number, and ta-da, there's all your comments. You don't even actually
have to have a post with an ID of that really high number, it'd work
regardless.
You could even extend this by having a really big number for each
image in the gallery. This way you'd be able to tell which comments go
with which images.
--
-David House, dmhouse at gmail.com, http://xmouse.ithium.net
More information about the wp-hackers
mailing list