homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / WordPress
Forum Library, Charter, Moderators: lorax & rogerd

WordPress Forum

Hooking in to "comment post" Action

WebmasterWorld Senior Member 10+ Year Member

Msg#: 4463600 posted 2:58 pm on Jun 10, 2012 (gmt 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...
add_action('loop-end','show_this_post_as_read'); 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?




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

Msg#: 4463600 posted 1:25 pm on Jun 11, 2012 (gmt 0)

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?

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / WordPress
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved