Add filter to comments loop?

I’m making a plugin which stores referrer data for comments. I already have my database table created, and the data is being stored correctly when a comment is made.

Now I would like to attach a custom div to the comment block for each comment. How would I add a filter to the comment loop? I want to say “if this comment ID has a referrer logged in my table, then print out the referrer in my special div”. I can write the function myself, I just need help on where to inject my function.

Solutions Collecting From Web of "Add filter to comments loop?"

It is hard to say what you need to hook into without knowing all the details but I think you may be able to use comment_text— more or less the the_content of comments.

  function ($comment) {
    return $comment.'<div>This is your special division</div>';

If that isn’t quite right, take a look at the filters listed in the Codex for comments.