• Resolved lesles08

    (@lesles08)


    We have a fairly large site for a client that is using the BBPress and Buddypress and BP Registration Options. When someone registers via the reg form, it sends them to be approved. BUT the same thing is happening when you create a user in the admin (like an administrator). This client adds users all the time as administrators and moderators and we don’t want them to have to approve all of them. How do we alter the plugin to not send users created in the admin to the approval process? Or at least specify that administrators, moderators, etc not have to be approved? Only those users that sign up through the registration form.

    Thank you!

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Michael Beckwith

    (@tw2113)

    The BenchPresser

    As is, we don’t have any way to differentiate between user capabilities and which, if any, should be auto approved.

    I do know that I typed this code up last month for a similar, but different issue around member types, that could prove useful to you. It’s not complete, and it is code, but it would run after we’ve marked the user as moderated, and would undo that for you right after.

    function bpro_per_role_moderation_override( $user_id ) {
    	$user = new WP_User( $user_id );
    	$roles = $user->roles;
    
    	// Here you would need to check the $roles variable for the ones
    	// you want to not be moderated. If they have one of those roles,
    	// run this line: bp_registration_set_moderation_status( $user_id, 'false' );
    }
    add_action( 'user_register', 'bpro_per_role_moderation_override', 11 );
    
    Thread Starter lesles08

    (@lesles08)

    Awesome! Thank you, it works great as far as not placing them into the approval process! Can I ask you another question? It still sent a “New Member Request” email to the administrators. Is there also a fix that will prevent that email from sending? I tried a couple things but it didn’t quite work.

    Michael Beckwith

    (@tw2113)

    The BenchPresser

    Not seeing any way to prevent that one, since it’s run and handled in our callback that sets the initial status.

    The only other option I can think of for this, would be to re-modify the snippet I provided above, but instead of running the function to set the status, instead have it run this line:

    remove_action( 'user_register', 'bp_registration_options_bp_core_register_account' );
    

    You would also need to replace the 11 priority with something like a 9 so that yours runs first to remove our action from consideration. Worth trying out and tinkering.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘New users created in admin – don’t need approval’ is closed to new replies.