Your CSV file should include:
1- Username
2- Password
3- First Name
4- Last Name
5- Email
6- Role
I have attached a sample CSV file, you can add all of your users there to create accounts for them.
First you have to upload the CSV file on your server, then we will create a trigger :
Code: Select allecho "<pre>";
$file = "/opt/processmaker/createUsers.csv"; // <-- use full path to the CSV file that uploaded to your server
$users = array_map('str_getcsv', file($file));
array_walk($users, function(&$a) use ($users) {
$a = array_combine($users[0], $a);
});
array_shift($users); # remove CSV file header
$count = count($users);
$i = 0;
while($i < $count) {
$var = PMFCreateUser($users[$i]["username"], $users[$i]["password"],$users[$i]["firstname"],$users[$i]["lastname"],$users[$i]["email"],$users[$i]["role"]);
if ($var == 0)
echo 'not created';
else
echo 'created:' . $users[$i]["username"] . '<br/>';
$i++;
}
die("</pre>");