I am trying to use user_save api. i have passed the following object ($user)
object(stdClass)#30 (6) { ["name"]=> string(12) "user_name" ["mail"]=> string(22) "[email protected]" ["pass"]=> int(1311514302) ["created"]=> int(1311514302) ["status"]=> int(1) ["roles"]=> array(1) { [0]=> string(10) "OauthUsers" } }
I have used the following function:
$user = new stdClass();
$user->name = $userdata['name'];
$user->mail = $userdata['email'];
$user->pass = time();
$user->created = time();
$user->status = 1;
$user->roles = array('OauthUsers');
user_save($user);
I have tried to drop the "roles" property as well, but in all the cases user_save() returns FALSE
.
Do you have any idea of what I am doing wrong?