Question: I can add custom fields to the user registration form, if I add the fields to the user profile: admin/config/people/accounts/fields

There is a checkbox "Show on user registraion" which is inactive:
![enter image description here](https://i.stack.imgur.com/T8azs.png)

The checkbox only gets active if I check "Mandatory field", but some of the fields must not be mandatory. Is that a bug? Is there a workaround (without using module 'Profil2') ?

I'm using Drupal Core 7.28

Answer: 
I have never encountered such problem before. But since you have such problem then I think the best way is to write a hook\_form\_alter. And set the required field that you don't want as mandatory to false.

```
function mymodule_form_alter(&$form, $form_state, $form_id){
switch ($form_id)  {
    case 'registration_form_id': 
                $form['field_name']['und'][0]['value']['#required'] = FALSE;
            break;
                   }
               }

```

Hope this helps.
It sounds like something is missing. Both of those options can be found on the field edit page. Both are usually available for checking. However, when you check the 'Required field' option, the 'Display on user registration form' option gets an automatic check and locked (making it virtually impossible to un-check it.) Otherwise when the 'required' option is not checked, the 'Display on user registration form' option should be completely accessible (not automatically checked and available for checking.) If this option is not available (when the 'required' option is not checked,) there may be something wrong with your Drupal Installation.