How may I hide/disable homepage field for anonymous users' comments in Drupal 7?
I want to keep email as obligatory, but I don't want to let them put their homepage.
Thanks

Comments

bleen’s picture

Try this in one of your modules (or even in your theme's template.php):

function mymoduleortheme_form_alter(&$form, &$form_state, $form_id) {
  switch($form_id) {
    case 'comment_node_article_form':
      $form['author']['homepage']['#access'] = FALSE;
      break;
  }
}
perumal.karthi’s picture

Thanks for the post. It works !!

juc1’s picture

@ bleen18 or anyone - can I please check - will this work in D6?

thanks

workonwomen’s picture

Any better solution?
I mean some CCK field setting like or....

Christoph Haas’s picture

Actually the answer is very simple and does not require any changes to templates, CSS or even the Drupal core.

Instead just go to Administration->Structure->Content types and for each content type edit the "Comment settings" and set "Anonymous commenting" to "Anonymous posters may not enter their contact information".

cyrion’s picture

@ Christoph Haas
Unfortunately, the emailadress-field will disappear as well...