How to hide Fivestar rating field after first comment? The accepted answer on How to limit a user to one vote when using Fivestar? doesn't work for me, but the author hasn't provided a solution yet, so I felt this is worth a new question.

My goal is exactly the same as the one in the article mentioned above: I'd like to hide the Fivestar rating field (called field_stars) in the comment form when a user comments on a node on which he/she's already commented.

Is there another solution (for example with the Rules and Flags modules)?



Edit: I already have a flag called Commented on my site and a rule that flags a node on behalf of the commentator when someone commented on it (which works perfectly). I'd really like to use it to fix this problem. I tried something, based on the information I found here:

function hiderating_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  global $user;
  $flag = flag_get_flag('commented') or die('no "commented" flag defined');
  if ($form_id == "comment_node_stuff_form") {
   if ($form['#node']-&gt;uid == $user-&gt;uid OR $flag-&gt;is_flagged($form['#node']-&gt;uid, $user-&gt;uid)) { 
      unset($form['field_stars']);
    }
  }
}


Unfortunately, it doesn't change anything (I don't get any errors either).
In your node.tpl.php you should have the following code

hide($content['field_fivestar']);
print singlerating_print_rating($node-&gt;nid, $content['field_fivestar']);


I presume field_fivestar is the fivestar field you are using and not field_fivestar_rating