How to not show a comments field if user logged in I have a field called 'email' I added to my node comments form. However I don't want this to display to users who are logged in. What's the best way to hide this field for logged in users?

I created a module 'hideemail.module' (and info file) with the following code, and flushed caches multiple times...but it's still not working. Note: I double-checked the form name with Firebug and the field name in the resource content type > comments fields.

From hideemail.module (and yes its enabled):

 &lt;?php
 /**
 * Implements hook_form_alter().
 */
function hideemail_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  global $user;
  if ($form_id == 'comment-form' &amp;&amp; $user-&gt;uid != 0) {
    $form['field_email']['#access'] = FALSE;
  }
}
?&gt;
Use hook_form_alter():

/**
 * Implements hook_form_alter().
 */
function my_module_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  global $user;
  if ($form_id == 'comment_form' &amp;&amp; $user-&gt;uid != 0) {
    $form['field_email']['#access'] = FALSE;
  }
}