1
我的自定义注册表单模块具有允许新用户选择一个或多个城市的选择字段。在我的搜索中,我没有找到任何可供借鉴的例子。例如,如果要保存的城市关键字是20和53,是否有人有下面的代码应该看起来像'field_city'=>的例子?user_save()具有多个选择字段,如复选框或选择字段
$edit = array(
'name' => 'tester',
'pass' => user_password(),
'mail' => '[email protected]',
'status' => 0,
'init' => '[email protected]',
'access' => REQUEST_TIME,
'field_city' => ,
'field_zip_postal_code' => array(LANGUAGE_NONE => array(array('value' => '12345'))),
'field_gender' => array(LANGUAGE_NONE => array(array('value' => 'Male'))),
);
user_save(drupal_anonymous_user(), $edit);