
Join free
Skip to: site menu |main content
Welcome to my personal site. If You have any question or suggestion please feel free to contact me from contact page.
Basic Idea behind importing user in drupal is:-
1)Create dummy user object...
2)Call drupal's user_save function...
Actually, You need to create the user account array first...and then pass it to function user_save().
<?php
//$account = user_save('',$user_array);
$password = user_password($your_password);
$user = array(
'name' => $username,// Whatever you have
'pass' => $password,//Encr
'mail' => $email,//Your email here in variable
//'roles' => array( 3 => 3 ),//Add some role ID if you have and uncomment it if any
'status' => 1,// By default make users active
);
$account = user_save('', $account);// Call user_save function
watchdog(
'user',
'New user: %name (%email).',
array('%name' => $username, '%email' => $email),
WATCHDOG_NOTICE,
l(t('edit'), 'user/'. $account->uid .'/edit')
);//Add in Log
//Now $account is anobject with newly user information in it
?>Module Of Interest:-
http://drupal.org/project/user_import
Recent comments
16 weeks 4 days ago
16 weeks 4 days ago
16 weeks 4 days ago
1 year 16 weeks ago
1 year 16 weeks ago
1 year 16 weeks ago
1 year 31 weeks ago
1 year 33 weeks ago
1 year 34 weeks ago
1 year 39 weeks ago