[wp-hackers] Automated user creation

Tassoman (mailing) ml at tassoman.com
Tue Dec 12 12:18:32 GMT 2006


Hi to all,
	is there a less dirty, working, and different by following method to
add uses into wordpress having a known user, pass and email?

$wpdb->query("INSERT INTO ". $wpdb->users . " (user_login, user_pass,
user_email, user_registered, user_url, user_nicename, display_name)
VALUES ('" . $username . "', '" . $vb_login['password'] . "', '" .
$vb_user['email'] . "', '" . date('Y-m-d H:i:s', $vb_user['joindate']) .
"', '" . $vb_user['homepage'] . "', '$username','$username') ");

$lastid = $wpdb->insert_id;

$usermeta['wp_capabilities'] = 'a:1:{s:10:"subscriber";b:1;}';
$usermeta['wp_user_level'] = 1;
$usermeta['rich_editing'] = 'false';
foreach ($usermeta AS $k => $v ) {
	$wpdb->query("INSERT INTO ". $wpdb->usermeta . " (user_id, meta_key,
meta_value) VALUES ('$lastid','$k','$v')");
}

-- 
Blogging humanum est, Tassoman ovest.
http://blog.tassoman.com



More information about the wp-hackers mailing list