Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • @cloudeddottedmind

    Participant

    Ok @shanebp, except I’ve switched back to BuddyPress & switched off BuddyBoss and it still happens when I go to the equivalent Friendships > Requests section. I am asking here because this is a Buddypress functionality I have an issue with, and would really love help.

    If I figure it out, I will happily share my findings in case it helps someone else.

    @cloudeddottedmind

    Participant

    My issue is resolved – this was a conflict with Woocommerce memberships & I’ve let them know and rolled back for now: https://buddypress.org/support/topic/error-404-profile-edit-group-1/#post-314987

    @cloudeddottedmind

    Participant

    Hi @h4ns3n I just saw your reply & this fix worked for me as well – I posted there with same issue I think: https://buddypress.org/support/topic/profiles-pages-permalinks-issue/

    I’ve contacted Woocommerce support to let them know

    @cloudeddottedmind

    Participant

    I figured it out… it was pretty simple in the end as all I did was change ‘role” to ‘role__not_in’ while putting the role I do want to show in $role

    /**
     * Exclude Users from BuddyPress Members List unless they have specific WordPress role.
     *
     * @param array $args args.
     *
     * @return array
     */
    function buddydev_exclude_users_by_role( $args ) {
        // do not exclude in admin.
        if ( is_admin() && ! defined( 'DOING_AJAX' ) ) {
            return $args;
        }
     
        $excluded = isset( $args['exclude'] ) ? $args['exclude'] : array();
     
        if ( ! is_array( $excluded ) ) {
            $excluded = explode( ',', $excluded );
        }
     
        $role     = 'roletoshow';// change to the role to be shown.
        $user_ids = get_users( array( 'role__not_in' => $role, 'fields' => 'ID' ) );
     
        $excluded = array_merge( $excluded, $user_ids );
     
        $args['exclude'] = $excluded;
     
        return $args;
    }
     
    add_filter( 'bp_after_has_members_parse_args', 'buddydev_exclude_users_by_role' );

    @cloudeddottedmind

    Participant

    Hi @prashantvatsh,
    I’ve tried your plugin. I wanted to set it to show any user that has the “Community Member” role, but when a user has two roles (admin and member for example), they get excluded.

    How may I make it so if a user a the correct role they get show even if their other role is excluded?

    Thank you

Viewing 5 replies - 1 through 5 (of 5 total)
Skip to toolbar