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):
<?php
/**
* Implements hook_form_alter().
*/
function hideemail_form_alter(&$form, &$form_state, $form_id) {
global $user;
if ($form_id == 'comment-form' && $user->uid != 0) {
$form['field_email']['#access'] = FALSE;
}
}
?>