Question

Okay I know the title is pretty vague but I didn't know how to articulate it.

Basically, I want a plugin that sends email notifications to users who opted-in only if they specifically got replied to.

WordPress has its built-in functionality for comment threading/replying, so instead of bombarding the user with emails each time a new comment is posted on a post they've subscribed to, I'd like to give them the option to only be notified when they specifically get replied to.

I can develop this myself if need be, in fact, a preliminary search yielding no results seems to point at this.

My question is, what hooks would I take a look at? Looking at other notifier plugins, I see they make use of comment_post and others which I can come up with myself. More specifically, how would I go about knowing if user x got a direct reply?

I understand how the subscription system and all of that would work, my only concern is how to tell if a subscribed user received a direct reply through the built-in commenting system.

Was it helpful?

Solution

I figured it out. Each comment row in the wp_comments table has a field named comment_parent which stores the comment_ID of the parent comment. If the comment has no parent, then the default is 0.

So I guess on each comment post I would check the database for the posted comment's parent, and if it matched the comment of a subscriber, notify him or her.

Sounds like a plan.

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top