Answer the question
In order to leave comments, you need to log in
How to automate the import of CSV users to 1C-Bitrix?
There is a regular functionality (/bitrix/admin/user_import.php) for importing users from CSV (created from a template).
Actions are:
Answer the question
In order to leave comments, you need to log in
Set a task in cron (or agent), sample code (taken from the same file that is responsible for import)
$csvImport = new CSVUserImport($csvFilePath, $arDelimeters[$delimeter]);
$csvImport->SetUserGroups($userGroups);
$csvImport->IgnoreDuplicate($ignoreDuplicate == "Y");
$csvImport->SetCallback("_OnUserAdd");
$csvImport->SetImageFilePath($pathToImages);
$csvImport->AttachUsersToIBlock($attachIBlockID);
if (!$csvImport->IsErrorOccured()) {
$csvFile =& $csvImport->GetCsvObject();
while ($csvImport->ImportUser()) {
/* ... тут можно делать список ошибок для дальнейшего вывода ... */
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question