wp_create_user() calling from an external script
-
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 protected]"; $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.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘wp_create_user() calling from an external script’ is closed to new replies.