Hi , i am importing users to drupal thanks to the user import module, but since i do not have the correct users email addr i am using an exel fake auto generate file to create the email for the users for i.e- 1000@me.com, 1001@me.com, 1002@me.com etc...

i am also using the profile module with fildes i have created for i.e name,email,date of birth etc...
and i am also using the login destination module to redirect users to the profile page on first login in order to fill up all the empty fildes.

so last thing i need is to copy the correct "email addr" from the profile module to the "user email addr" (this will also del the user fake email addr)
and i want this to tun automatically for i.e with cron or cron.php

can this be accomplish ?
can this be done by a php-snippet ?
any idea's ?

Comments

liorkesos’s picture

Hi,
To achieve the above you need to execute the next code in formid_submit of the profile...
Because you're using the profile I think the form name is user_edit.

function user_edit_submit($form_id,$form_values,$form){
  global $user; //get the current $user object 
  $user->mail = $form_values['profile_name']['mail'];
  user_save($user);
}

I haven't really tried this but that the general idea.
You can read more on form_api at
http://groups.drupal.org/node/2284
and
http://api.drupal.org/api/5/file/developer/topics/forms_api.html

Good luck..
Lior

Fidelis’s picture

Hi yavan -

I am trying to attemp the same thing - import a list of users using the user_import module, from a CSV file that has no emails for the users.

Two questions:

(1) Is there any way for drupal to accept a user without having to provide an email? When that user logs in the first time, they can supply their own emails, or none... Why is it mandatory to provide an email? (the context of the web site I'm developing is to be managed by a high school teacher for high school children; they will receive their username / password in class)

(2) if it is necessary to provide drupal with a fake email, how were you able to do this in Excel? I tried the auto-fill (i.e. selecting two adjacent vertical cells, like 1000@me.com and 1001@me.com, and dragging down the selection but that does not work as Excel treats the entries as email instead of numbers) without success...

Thanks!

patrick

Fidelis’s picture

Never mind - I figured it out by concatening fields... thks