I am building a script that creates new users and I need access to the functions within registration.php.
I have tried just including this file, but then get undefinded function get_userdatabylogin() and it seems I need to include a whole load of other files. Is there just one file I can include so I can perform the functions within registration.php?
The code I am trying to execute from my external script looks like this:
<?php
require_once('wp-includes/registration.php');
$user_name = "new_user";
$user_email = "email@email.com";
$user_id = username_exists( $user_name );
if ( !$user_id ) {
$random_password = wp_generate_password( 12, false );
$user_id = wp_create_user( $user_name, $random_password, $user_email );
} else {
$random_password = __('User already exists. Password inherited.');
}
?>
And I am using WordPress version 2.9.2.