All plugins works, but in my custom plugin $wpdb, wp_create_user, wp_insert_user doesn’t works.
For example, doesn’t work
$user_id = 1;
$website = 'http://wordpress.org';
wp_insert_user( array ('ID' => $user_id, 'user_url' => $website) ) ;
global $wpdb;
if(!isset($wpdb)) {
require_once('../../../wp-config.php');
//require_once('../../../wp-load.php');
require_once('../../../wp-includes/wp-db.php');
}
$insertUser = "INSERT INTO $wpdb->users (user_login, user_pass, user_email, user_url) VALUES ('123', '123', 'rokk@gmail.com', 'lasad.com')";
$wpdb->query( $insertUser );
Your reference to the user table is incorrect.
Under your declaration of global $wpdb;
try this
and then in your sql,
instead of using the reference $wpdb->users in your query, use:
you can use this for any wordpress table, just make sure you are naming your table correctly, double check the table names in phpmyadmin
But for your case Id avoid doing this insert and use the wordpress function
http://codex.wordpress.org/Function_Reference/wp_create_user
Try out the example there. It contains essential checks that you need to do before entering a new user, such as if they already exist/duplicate user names. And will automatically set things like the User_Id number, and randomize your password so it isnt shown in plain text.