• Resolved paulm-ua

    (@paulm-ua)


    I’m using New User Approve, Gravity Forms (custom registration page), and WordPress Access Control plug-ins. I also have Nav Menu Roles and User Role Editor, but I’m not using them for now.

    When user is approved, the new user Role is not set (it reads as None…it should be Subscriber). So, they can’t access any of the Members Only pages even though they are logged in on the site.

    I’m going to look into using the new_user_approve_approve_user filter to set the Role, but I thought that should happen by default when the user is approved, since Subscriber is set as the default Role for new users.

    What am I missing?

    Note: I’m also using the following filters, in case any of these may conflict with setting the user role:

    new_user_approve_bypass_password_reset
    new_user_approve_approve_user_subject
    new_user_approve_approve_user_message
    new_user_approve_deny_user_subject
    new_user_approve_deny_user_message

    https://wordpress.org/plugins/new-user-approve/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter paulm-ua

    (@paulm-ua)

    I tried to use the following action in my functions.php file, but it didn’t work (what did I screw up):

    // *** Set the Role of the new user to Subscriber when the user is approved ***
    function set_user_role_to_subscriber($user) {
    $wp_user_object = new WP_User($user->ID);
    $wp_user_object->set_role(‘subscriber’);
    }
    add_action( ‘new_user_approve_approve_user’, ‘set_user_role_to_subscriber’, 10, 1 );

    By default, when a user registers on a site, the user will get the Subscriber role. The New User Approve plugin does not modify this in any way. One of the other plugins you have installed is likely the culprit.

    I’d disable all plugins and then enable them one by one to find out which one it is. If you do find that the NUA plugin is causing problems, please let me know.

    Thread Starter paulm-ua

    (@paulm-ua)

    I found the issue in the code triggered when the user register form was submitted. It was not related to New User Approve. Thank you for looking at this issue!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘User Role not set correctly when Approved’ is closed to new replies.