This topic has 2 replies, 2 voices, and was last updated 9 years by Andrei.

  • Author
  • #54661
     mitchcan
    Participant

    Hey,

    I am trying to hide specific PMP roles from the BP members page in Kleo. The folks at PMP gave me some code that kinda sorta works. It DOES remove the member information, but leaves the empty box displayed where the information was.

    I tried placing this code in either the custom plugin I had created for BP stuff, or the buddypress functions file within the Kleo theme (yes, if it worked there, I would have created/placed it instead in a child theme) 🙂 In neither case did it function as I expected. (see attached screencap)

    Could you please let me know if it should a) go in a different place or b) if the code needs some specific Kleo tweak to work.

    Thanks so much. Have as great day!

    Attachments:
    You must be logged in to view attached files.
    #54672
     mitchcan
    Participant

    You know, I should probably show the code I was using… that might be helpful. 🙂

    COPY CODE
    /*
     * Hide certain membership levels in BuddyPress directory
     */
    function my_bp_has_members($has_members, $members_template) {
    
        global $members_template;
    
        //pmpro membership levels to hide
        $levels = array(1,2,3);
    
        //get list of members
        $members = $members_template->members;
    
        foreach($members as $key=>$member) {
            if(pmpro_hasMembershipLevel($levels, $member->id))
                unset($members_template->members[$key]);
        }
        return $has_members;
    }
    add_filter('bp_has_members', 'my_bp_has_members', 10, 2);
    
    #55169
     Andrei
    Moderator

    You need to hide the entire profile form the listing, or just some information from it’s profile listing box ?

    Looking forward.
    Cheers

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
Viewing 3 posts - 1 through 3 (of 3 total)

The forum ‘General questions’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?