Support » Miscellaneous » Create a new user with user level 3
9 years, 5 months ago
I’m trying to create a new user with user level 3, and having little success.
I’m using this code in the “register” case on wp-login.php
$user_id = wp_create_user( $user_login, $user_pass, $user_email );
but all new users have an user level of 0.
the email goes out and the page redirects so i know i am running the code.
Can someone help me out, it seems like a simple problem but it is driving me crazy.
Thanks in advanced.
9 years, 4 months ago
I had the same problem. But i used
$user_id->set_role(‘administrator’); //Set the role
function to set the roles.
It much easier and it works.