Answer the question
In order to leave comments, you need to log in
How to import users into 1C-Bitrix?
There is a CSV file of the form:
LOGIN;NAME;EMAIL;PASSWORD;UF_FIELD_NAME
and, accordingly, there is data of the form:
ivan;Ivan;[email protected];Qwerty123;abcd The
question is how to import users with passwords? Passwords in unencrypted form.
Answer the question
In order to leave comments, you need to log in
$csvData = file_get_contents('./people.csv');
$lines = explode(PHP_EOL, $csvData);
$array = array();
foreach ($lines as $line) {
$array[] = str_getcsv($line);
}
print_r($array);
Array
(
[0] => Array
(
[0] => 12345
[1] => Computers
[2] => Acer
[3] => 4
[4] => Varta
[5] => 5.93
[6] => 1
[7] => 0.04
[8] => 27-05-2013
)
[1] => Array
(
[0] => 12346
[1] => Computers
[2] => Acer
[3] => 5
[4] => Decra
[5] => 5.94
[6] => 1
[7] => 0.04
[8] => 27-05-2013
)
)
$user = new CUser;
$arFields = array(
"NAME" => $name,
"LOGIN" => $login,
"EMAIL" => $email,
"PHONE_NUMBER" => $phone,
"LID" => "ru",
"ACTIVE" => "Y",
"PASSWORD" => $pass,
"CONFIRM_PASSWORD" => $pass,
"GROUP_ID" => array(10, 11)
);
$new_user_ID = $user->Add($arFields);
require_once($_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/main/include/prolog_before.php");
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question