Welcome to WebmasterWorld Guest from

Forum Moderators: rogerd & travelin cat

Message Too Old, No Replies

Hooking in to "comment post" Action

2:58 pm on Jun 10, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:June 6, 2004
posts: 2239
votes: 0

I'm using wordpress to build a site that contains a number of articles that I want students to read and then post a comment on. Once the comment is posted, I want the main page of the site to then display that post name with a strike-through, indicating it is an article which that particular user has already read.

I'm using...

...where show_this_post_as_read is a function which takes no arguments.

All of my functions, database calls, etc are working IF I tie the execution of the above function to some other API action. For instance...
works fine. The site indicates a post as being read after a user visits a particular post. But I don't want posts that users just clicked into to be marked as having been read. I want it tied to whether or not they commented, as this is a better indication of whether or not they really read the post.

For some reason, hooking to the "comment_post" action is not working for me. I have literally SCOURED the web looking for some insight into why this is not working and have found nothing.

If anyone has ever met with success using this hook in Wordpress, would you mind helping me figure out what I'm missing?

1:25 pm on June 11, 2012 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lorax is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Mar 31, 2002
votes: 4

I haven't actually done what you're trying to do but in looking at the WP documentation it looks like 'comment_post' has multiple return values ( [codex.wordpress.org...] ) which leads me to wonder what the triggers are in your function?