WordPress.org

Support

Support » Miscellaneous » Create a new user with user level 3

Create a new user with user level 3

  • 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 );
    wp_new_user_notification($user_id, $user_pass);
    update_usermeta($user_id,'user_level',3);
    wp_redirect('wp-login.php?checkemail=registered');

    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.

Viewing 1 replies (of 1 total)
  • Hi

    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.

Viewing 1 replies (of 1 total)
  • The topic ‘Create a new user with user level 3’ is closed to new replies.
Skip to toolbar