views:

66

answers:

1

Is it possible to get information about the commenter with the comment_text action in wordpress?

What I want to do is modify a comment someone makes based on who they are, like if they are user_a I might want to make their comments show up as green, if they are user_b I might want their comments to be bolded, or formatted differently.

+1  A: 

Use the function get_comment_text

$comment = get_comment_text();
var_dump($comment); 

Untested, but usually a function prefixed by "get_" in wordpress returns the value instead of directly echoing it.

Anyway, you need the author's information too, so you have to get the comments via get_comments and loop through them.

http://codex.wordpress.org/Function_Reference/get_comments

$comments = get_comments('post_id=15');
  foreach($comments as $comm) :
    echo($comm->comment_author);
  endforeach;
Alex
Ah that seems like it would work! Just one question though, is it possible to get the post id of a post from the posts page?
meds
Yes, the_ID() inside the posts loop should return the current post ID. Again, use get_the_ID() to return it. http://codex.wordpress.org/Template_Tags/the_ID
Alex