How to make a comment only visible to the commenter before approval? There is no registered users (apart from user/1 of course ...) in the website and anonymous visitors have the permission to comment on the website.

Comments are not shown before approval.

What I want to do is to display a comment to commenter only before I approve it. So this is what I'm looking for: 


  Only display a comment posted by 'X' to 'X' (nobody else) for as long
  as the comment has not been approved by a reviewer, AND on condition X
  is using the same browser as the one the comment got posted with.


I couldn't use "userid" etc. for (anonymous) visitors. What can be used for that (session, IP address etc.)?



The feature I asked for is similar to the peer review feature you see on any SE site, which is like so:



How can I do it?
Things you need to know:

hook_node_view
hook_query_TAG_alter
db_or

Step I read code.
Step 1: find function comment_node_view this function define element comment in array render of node.
Step 2 find line 711
$node-&gt;content['comments'] = comment_node_page_additions($node);//define comment

Step 3 go to function comment_node_page_additions see code.
if (($node-&gt;comment_count &amp;&amp; user_access('access comments')) || user_access('administer comments')) {
    $mode = variable_get('comment_default_mode_' . $node-&gt;type, COMMENT_MODE_THREADED);
    $comments_per_page = variable_get('comment_default_per_page_' . $node-&gt;type, 50);
    if ($cids = comment_get_thread($node, $mode, $comments_per_page)) {
      $comments = comment_load_multiple($cids);
      comment_prepare_thread($comments);
      $build = comment_view_multiple($comments, $node);
      $build['pager']['#theme'] = 'pager';
      $additions['comments'] = $build;
    }
  }

Step 4 If user is anonymous $node-&gt;comment_count = 0. so condition is false. Don't add comment. (Problem 1)
Step 5 function comment_get_thread
if (!user_access('administer comments')) {
    $query-&gt;condition('c.status', COMMENT_PUBLISHED);
    $count_query-&gt;condition('c.status', COMMENT_PUBLISHED);
  }

this function return array store cids (all comment of node) with condition status is published (don't get comment of user is anonymous) Problem 2.
Problem solving
Problem 1: Use hook_node_view to set $node-&gt;commentcount != 0 (require this function run before function comment_node_view. You can set weigh of module (sure test with value is -1) or name of module start with a or b (not sure)).
/**
 * Implements hook_node_view().
 */
function ModuleName_node_view($node, $view_mode, $langcode) {
  global $user;
  if ($user-&gt;uid == 0 &amp;&amp; $node-&gt;comment_count == 0) {
    $node-&gt;comment_count = 1;
  }
}

Problem 2
You need alter this query to get comment published or current user is author of comment. To do it i need hook_query_TAG_alter.
You can write a custom module with code:
/**
 * Implements hook_query_TAG_alter().
 */
function ModuleName_query_comment_filter_alter(QueryAlterableInterface $query){
  global $user;
  if (!user_access('administer comments')) {
    $conditions = &amp;$query-&gt;conditions();
    foreach ($conditions as $key =&gt; $condition) {
      if (is_array($condition) &amp;&amp; is_string($condition['field'])
        &amp;&amp; $condition['field'] == 'c.status'
        &amp;&amp; $condition['value'] == COMMENT_PUBLISHED) {
        unset($conditions[$key]); // unset condition comment is public
        $or = db_or();
        $or-&gt;condition('c.status', COMMENT_PUBLISHED);
        //$or-&gt;condition('c.uid', $user-&gt;uid); this case for require use login to comment
        $or-&gt;condition('c.hostname', $user-&gt;hostname); // Ip of user
        $query-&gt;condition($or);
        return;
      }
    }
  }
}   

NOTE: All the users have the same IP are seeing comment.