Drupal user_save?

This Comment will be submitted for moderation and will not be accessible to other users until it has been approved.


-5 points

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

 



-10 points

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.

Anonymous's picture
Created by sudeepg (not verified)
46 points

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>

programmer's picture
Created by sudeepg
3 points

missing a closing ")"...

Anonymous's picture
Created by Anonymous

Post Comment

  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <php>, <python>, <ruby>. Beside the tag style "<foo>" it is also possible to use "[foo]". PHP source code can also be enclosed in <?php ... ?> or <% ... %>.