When anonymous users are registering and creating a group - the field:

Determine if this should be a group.

Shows up on registration.

enter image description here

In the field settings on the content type I'm using I have the values checked to "Hide" this portion. I've even hid the values on Manage Display.

Screen shots attached. All I want to do with is hide the field to NOT show to users. There's no reason for this field to be visible in my scenario.

enter image description here enter image description here

I don't want to hide it with css if at all possible.

Any guidance is appreciated.

1 Answer 1


You could use hook_form_alter() to change the field type for the field you want to hide to "hidden". The code would be something like this:

mymodule_form_alter(&$form, &$form_state, $form_id) {
  switch($form_id) {
    case "user_register_form":
      $form["fieldname"]["#type"] = "hidden";
      $form["fieldname"]["#value"] = $form["fieldname"]["#default_value"];

This function will get called for every form displayed, so the switch statement makes sure it's the right form. That being the case, the next line changes the type of the field to a hidden field. Finally, it copies the default value of the field into the actual value (hidden fields don't have a default value).

Unfortunately I don't know what the name of the field you want to change is, so you'll have to investigate that.

Hope this gets you on the right track.

  • The field in question that I want to hide is in a "content type." In the case switch, is that where I'd reference the type of form i want to alter?
    – Max
    Jan 4, 2016 at 17:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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