I have created a custom field on the user entity. I would like to prepopulate this field with the value 0. So, when the user goes to their account page after registration the field is already filled in, which they are then free to change. Just like the username and email. The only way I can think to do this is to alter the registration form. I added this to my module, but when I created a new user, a new row did not appear in the field table. My module function:
function MYMODULE_form_user_register_alter(&$form, &$form_state, $form_id) {
$form['account']['field_MYFIELD'][LANGUAGE_NONE][0] = array(
'#type' => 'value',
'#value' => 0,
);
}
Where am I going wrong, or is there a better approach. Thanks.