2

How I could make from my template.php author/user field in comments required for those who are anonymous users

I tried with this but it didn't work for me

function MYTHEME_theme() { $form['author']['_author']['#required'] = TRUE; }

I've been searching around but can't find a proper answer :/

2

You have to create a little module and implement hook_form_FORM_ID_alter() to alter the form.

0

Make comment name field mandatory

function [Your_modulename]_form_alter(&$form, &$form_state, $form_id) {

   if ($form_id == 'comment_node_blog_form') {   //if your content type is blog

      $form['author']['name']['#required'] = TRUE;

    }  
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.