Set boolean (single on/off checkbox) value while creating a user I am creating a user programmatically and there is a boolean field (single on/off checkbox) being used as a terms of use inside the users profile.

How do I set the value of it when creating a user object? I need it to be checked or 1.

$new_user = array(
                'name' =&gt; $username,
                'mail' =&gt; $email,
                //'pass' =&gt; $pass,
                'signature_format' =&gt; 'full_html',
                'status' =&gt; 1,
                'access' =&gt; 0,
                'timezone' =&gt; 'America/New_York',
                'init' =&gt; $email,
                'field_user_account_terms' =&gt; array(
                    'attributes' =&gt; array(
                        'checked' =&gt; 'checked',
                    ),
                ),
              );

$account = user_save(NULL, $new_user);


i've also tried

                    'field_user_account_terms' =&gt; array(
                    'und' =&gt; array(
                        0 =&gt; array(
                            'value' =&gt;  1,
                        ),
                    ),
                ),          


I've also tried setting the default value and a bunch of other syntax. Nothing seems to be working for me.

is this even possible? What is the correct syntax for setting the value of a checkbox, to be saved in a users profile?
The help message for this field says: If left empty, "1" will be used and if left empty, "0" will be used. So I left this field blank and assumed you could programmatically set the value while creating a user. This doesn't work at all for me.



You actually have to explicitly define the On and Off values in order to be able to set them while creating a user.



Then you can set the value in the user object.

'field_user_account_terms' =&gt; array(
                'und' =&gt; array(
                    0 =&gt; array(
                        'value' =&gt;  1,
                    ),
                ),
            ),