Show comment module but have it disabled for anonymous users I have what I believe is a slightly unusual requirement for comments. I'm trying to figure out how to implement this:


Comment form should always appear at the bottom of the page (this helps
users understand they can submit a comment especially if there are no comments yet for a given article)
If the user is registered the comment form should be enabled.
If the user is anonymous the comment form should be disabled and provide a
link to registration


It seems like the comment module is generally built to be on or off. Any recommendations on exposing it as a disabled form?
I didn't know this until I just tried it but you can use a hook_form_alter() function in a custom module and simply set the whole $form to disabled...this disables all child elements as well. Combine it with the user_is_anonymous() function and you should be set:

function MYMODULE_form_comment_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  if (user_is_anonymous()) {
    $form['#disabled'] = TRUE;
    // Add a link:
    $form['register_link'] = array(
      '#markup' =&gt; l('Click here to register...', 'user/register')
    );
  }
}