• stevec0023

    (@stevec0023)


    Hi

    Firstly, great plugin! Thanks so much for your efforts!!

    I have a site where only certain user roles can access the Buddypress pages. My ‘subscribers’ cannot.
    Is there a way that I can stop the plugin from executing if the user has the ‘subscriber’ role?

    Any help would be much appreciated

    Thanks
    Steven

Viewing 1 replies (of 1 total)
  • Plugin Author Ravi Sharma

    (@raviousprime)

    Hello Steven,

    Thank you for using the plugin. There is a filter which allows us to tweak the profile completion check. Please use the following code:

    add_filter( 'bp_force_profile_completion_skip_check', function ( $skip ) {
    
    	// Only checking for loggedin users.
    	if ( is_user_logged_in() ) {
    		$user = wp_get_current_user();
    
    		// Will skip if user has subscriber role or Users with multiple roles with in which subscriber role is present.
    		$skip = in_array( 'subscriber', (array) $user->roles, true );
    	}
    
    	return $skip;
    } );

    Please try this code and let me know if it helps or not.

    Regards

    Ravi

Viewing 1 replies (of 1 total)
  • The topic ‘Execute only based on user Role’ is closed to new replies.