Howdy,

I can import users and their associated content just fine, however Welcome Emails are not being sent out. I am getting the following errors after importing them:

warning: Invalid argument supplied for foreach() in
/sites/all/modules/user_import/user_import.module on line 1045.
warning: Variable passed to each() is not an array or object in
/sites/all/modules/user_import/supported/user_import.inc on line 55.

which is this line in user_import.module

foreach ($type_options as $field_id => $label) {

and in user_import.inc

'!edit_uri' => url('user/'. $account->uid .'/edit', NULL, NULL, TRUE),

I have set the username to be the email address. I have tried to set it to their First Name, Last Name, but neither change seems to be making any difference. Welcome Emails are still not being sent out.

Any help or pointers would be greatly appreciated.

A couple of ideas:

1. At the moment there seems to be a little problem if you have multiple nodeprofiles. If you import a user with nodeprofile data it creates a node for each nodeprofile, even though only one should be created. There is no option at the moment to select which nodeprofile it should create.

2. There also seems to be no option to sign people who are imported to be signed up to simplenews.

Best,
Christian

Comments

cnolle’s picture

I should add that this error occurs whenever I pick a CSV file to import (even sample.txt) and click next:

warning: Invalid argument supplied for foreach() in /sites/all/modules/user_import/user_import.module on line 1045

cnolle’s picture

It turns out that this has something to do with the use of the SMTP module, user import seems to ignore its settings.

cnolle’s picture

Update:

The issue lies with user_import.inc. By default using the mail function directly and drupal_mail:

(Around line 92)

Was:
mail($account->mail, $subject, $body, $header);

Change to:

$to = $account->mail;
$from = $user->mail;
drupal_mail($account->mail,$to, $subject, $body, $from);

Its working but its not sending out the auto generated password.

cnolle’s picture

Another update:

Just a quick note. Do NOT upgrade to the latest version of node import (1.8 as of writing) as it won't work with user import and nodeprofiles. Rather use 1.6 as that version works just fine. I am not sure what the difference is between the two versions.

C

ambereyes’s picture

Two causes:

  1. The send mail command is commented out at line 90 of user_import.inc
  2. The password variable is not filled with anything in _user_import_process function before being used to call the user_import_after_save function in user_import.inc which calls the function with the commented out send mail comand.

Katrina

--
www.ambereyes.net

ambereyes’s picture

BTW, your comment (ideas) about problems with node profiles is a separate bug, and in a strange way is kind of related to one of my issues #323118: Missing location fields within node profiles during user import but it should probably be treated as a separate bug in this queue. If I get time, I will dig up my research on it. But please go ahead and create an issue for it.

Katrina

--
www.ambereyes.net

ambereyes’s picture

I fixed the #2 cause (in comment #5) by setting the password variable prior to the module invoke call in the _user_import_process function in user_import.module at about line 1420.

$password = $account_additions['pass'];
module_invoke_all('user_import_after_save', $settings, $account, $password, $fields);

Katrina

--
www.ambereyes.net

cnolle’s picture

Howdy,

Thanks for your fix above. I am not using it for now, instead I am sending out the one-time login URL, which in some ways (or at least for my purpose) is better as it forces the newly registered user to set their own password immediately. I have opened an issue regarding the ability to select your Node profile content on import.

Best,
Christian

robert castelo’s picture

Status: Active » Fixed

Fixed in 5.x-2.0-beta1.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.