Hi,
Welcome to BuddyDev.You can use the following code to skip non subscribers from the check.
/** * Skip non subscribers from the profile completion check. */ add_filter( 'bp_force_profile_completion_skip_check', function ( $skip ) { if ( current_user_can( 'edit_posts' ) ) { $skip = true; } return $skip; } );
Please put it in your theme’s functions.php or if you have bp-custom.php in your wp-content/plugins, you can put it there.
Regards
BrajeshThank you for you reply Brajesh!
As I have other roles who can edit posts but would require profile completion, is it possible to get it by role? So that only role=donor can skip profile.
I tried
$user = get_userdata( $user_id ); $user_roles = $user->roles; add_filter( 'bp_force_profile_completion_skip_check', function ( $skip ) { if ( in_array( 'donor', $user_roles, true ) ){ $skip = true; } return $skip; } );
but without success. Maybe you can help me?
Thank you 🙂
You are welcome.
you may want to try something like this instead
add_filter( 'bp_force_profile_completion_skip_check', function ( $skip ) { $user_roles = wp_get_current_user()->roles; if ( in_array( 'donor', $user_roles, true ) ) { $skip = true; } return $skip; } );
We need to get the role of current user. So, I have updated the code.
Regards
BrajeshThank you for confirming. I am glad it worked 🙂
Regards
Brajesh
The topic ‘ [Resolved] BuddyPress Profile Completion – User Roles’ is closed to new replies.