Bitrix Site Manager

CUser::Add

mixed
CUser::Add(
 array fields
)

The method Add adds a new user. Returns the ID of the added user on success, or false otherwise. In the latter case, the LAST_ERROR property contains the error description.

Parameters

fields Array of field values in the format array("field"=>"value" [, ...]). The field names may include all the CUser class fields as well as GROUP_ID - an array of user group ID's to which the user belongs.

See Also

Example



<?
$user = new CUser;
$arFields = Array(
  "NAME"              => "John",
  "LAST_NAME"         => "Smith",
  "EMAIL"             => "ivanov@microsoft.com",
  "LOGIN"             => "ivan",
  "LID"               => "ru",
  "ACTIVE"            => "Y",
  "GROUP_ID"          => array(1,2),
  "PASSWORD"          => "123456",
  "CONFIRM_PASSWORD"  => "123456",
  );
$ID = $user->Add($arFields);
$strError .= $user->LAST_ERROR;
?>