Accept specific role
-
I wrote following function to accept ‘user’ role created at registration, but unfortunately it doesn’t auto-approve this user
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' );
Does anybody knows, what is wrong here?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Accept specific role’ is closed to new replies.