Drupal user_save?



How do we use drupal_save function? Can somebody please elaborate?

 



It is quite simple. see following:



<?php

 user_save
($account, array('mail'=>'abc@gmail.com');

?>

if $account is null, a new user is created else mail information is updated for $account. I hope this helps.

Actually, if you want to create a new user account, correct syntax is:

 <php><?php

 

$userinfo = array(
'name' => $name,
'pass' => user_password(),
'init' => $name,
'status' => 1, 'mail'=>'abc@abc.com',
      'access' => time()
);
$account = user_save('', $userinfo);

?> </php>

missing a closing ")"...