以编程方式在 vTiger 6 中创建用户
Create user in vTiger 6 programmatically
我想以编程方式在 vTiger 中创建用户,我需要了解当我们从 UI 添加用户时后台发生了什么。如果我能理解流程,我可以通过编写代码来复制它。
或者有 API 吗?
代码如下:
require_once 'modules/Users/Users.php';
$user_email='new_user@yourdomain.com';
$role_id_to_assign='H1';
$user = new Users();
$user->column_fields["last_name"] = 'John';
$user->column_fields["user_name"] = 'Mee';
$user->column_fields["status"] = 'Active';
$user->column_fields["is_admin"] = 'off';
$user->column_fields["user_password"] = $user_password;
$user->column_fields["tz"] = 'Europe/Berlin';
$user->column_fields["holidays"] = 'de,en_uk,fr,it,us,';
$user->column_fields["workdays"] = '0,1,2,3,4,5,6,';
$user->column_fields["weekstart"] = '1';
$user->column_fields["namedays"] = '';
$user->column_fields["currency_id"] = 1;
$user->column_fields["reminder_interval"] = '1 Minute';
$user->column_fields["reminder_next_time"] = date('Y-m-d H:i');
$user->column_fields["date_format"] = 'dd-mm-yyyy';
$user->column_fields["hour_format"] = 'am/pm';
$user->column_fields["start_hour"] = '08:00';
$user->column_fields["end_hour"] = '23:00';
$user->column_fields["imagename"] = '';
$user->column_fields["internal_mailer"] = '1';
$user->column_fields["activity_view"] = 'This Week';
$user->column_fields["lead_view"] = 'Today';
$user->column_fields["email1"] = $user_email;
$user->column_fields["roleid"] = $role_id_to_assign;
$new_user_id = $user->save("Users");
它将 return 新用户的 ID。用户将被分配给角色 CEO ('H1')。
我想以编程方式在 vTiger 中创建用户,我需要了解当我们从 UI 添加用户时后台发生了什么。如果我能理解流程,我可以通过编写代码来复制它。
或者有 API 吗?
代码如下:
require_once 'modules/Users/Users.php';
$user_email='new_user@yourdomain.com';
$role_id_to_assign='H1';
$user = new Users();
$user->column_fields["last_name"] = 'John';
$user->column_fields["user_name"] = 'Mee';
$user->column_fields["status"] = 'Active';
$user->column_fields["is_admin"] = 'off';
$user->column_fields["user_password"] = $user_password;
$user->column_fields["tz"] = 'Europe/Berlin';
$user->column_fields["holidays"] = 'de,en_uk,fr,it,us,';
$user->column_fields["workdays"] = '0,1,2,3,4,5,6,';
$user->column_fields["weekstart"] = '1';
$user->column_fields["namedays"] = '';
$user->column_fields["currency_id"] = 1;
$user->column_fields["reminder_interval"] = '1 Minute';
$user->column_fields["reminder_next_time"] = date('Y-m-d H:i');
$user->column_fields["date_format"] = 'dd-mm-yyyy';
$user->column_fields["hour_format"] = 'am/pm';
$user->column_fields["start_hour"] = '08:00';
$user->column_fields["end_hour"] = '23:00';
$user->column_fields["imagename"] = '';
$user->column_fields["internal_mailer"] = '1';
$user->column_fields["activity_view"] = 'This Week';
$user->column_fields["lead_view"] = 'Today';
$user->column_fields["email1"] = $user_email;
$user->column_fields["roleid"] = $role_id_to_assign;
$new_user_id = $user->save("Users");
它将 return 新用户的 ID。用户将被分配给角色 CEO ('H1')。