Checking whether or not an unpublished comment exists on node for current user I'd like to be able to let a user know that their comment has been submitted and is awaiting approval on every view of that particular node, not just a notification printed in the message region immediately after a submission.  I assume there's a way to cross-check the current node's unpublished comments and print something in the comment area if the user shows up as an author of an unpublished comment.  I have a feeling I can write a simple function, something like below, but I'm missing something and I'm not sure where to run it (ie, in the .tpl or in an .inc):

function find_unpublished_comments_of_current_user(&amp;$comment, &amp;$user) {
    if ($comment-&gt;status == 0 &amp;&amp; $user-&gt;id == $comment-&gt;uid){
      //something here 
      }
}


Thanks for any help.
You can achieve this in either of the following way,

1) If you are writing custom function as described in question, 
   a) Write your function in a block by selecting text format as PHP code, and display the   block in desired region.
   b) Otherwise define the function in your module and call it in your node template file node--type.tpl.php

2) Through view: Create a view to show un published comments of a node as follows,

View

Create a view:
Settings:
  Show: Comments
  Create block: select
  Click save &amp; continue

Filter criteria
 Comment: Approved (No) 
Advanced->Add
 Contextual filters


Content: Nid

Under When the filter value is NOT available

Provide default value : Content ID from URL
Comment: Author uid 
  Provide default value ->choose user id from logged in user


Now assign your block to a region on the node display page, you will get unpublished comments of the particular user for that node,