Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically approve specific user role #83

Open
spacemind-studio opened this issue Mar 30, 2020 · 0 comments
Open

Automatically approve specific user role #83

spacemind-studio opened this issue Mar 30, 2020 · 0 comments

Comments

@spacemind-studio
Copy link

Hello, I wrote following function to auto approve users with 'user' role created at registration. However it seems this doesn't fire because users still has status 'pending'. Could you point me to the directon what is wrong?

function sww_approve( $user_id ) {
	$roles = get_userdata( $user_id )->roles;
	if ( 'pending' == pw_new_user_approve()->get_user_status( $user_id ) && in_array( 'user', $roles ) ) {
		pw_new_user_approve()->update_user_status( $user_id, 'approve' );
	}
}
add_action( 'new_user_approve_approve_user', 'sww_approve' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant