/ Published in: PHP
programmatically create a new user with PHP
Expand |
Embed | Plain Text
<?php 'name' => 'username', 'pass' => 'password', // note: do not md5 the password 'mail' => 'email address', 'status' => 1, 'init' => 'email address' ); user_save(null, $newUser); ?> And, here's how you can update an existing user: <?php // load user object $existingUser = user_load('USERID'); // update some user property $existingUser->some_property = 'blah'; // save existing user ?> If you wanted to update an existing user's profile data: <?php // load user object $existingUser = user_load('USERID'); // create an array of properties to update 'profile_first_name' => 'Eric' ); // save existing user user_save( $edit, 'Personal Information' // category ); ?>
You need to login to post a comment.
