Skip to:
Content
Pages
Categories
Search
Top
Bottom

Overriding number of Friends in the Profile


  • Mike Witt
    Participant

    @mike80222

    Hi,

    I’m running MemberPress/BuddyPress/bbPress for a membership site. I need to restrict various displays to “active members.”

    In the primary Members display I’ve done this with a combination of:
    (1) Filtering bp_after_has_members_parse_args to exclude users who are not active.
    (2) Overriding buddypress/members/index.php – to eliminate the (now incorrect) number of members and friends at the top

    The only issue I have left is that in a user’s profile it still shows the (potentially incorrect) number of Friends in a little circle after the word “Friends.”

    I haven’t been able to figure out what file to override in order to simply eliminate that number. If it matters, I’m using the “legacy” version.

    I hope I’ve explained that sufficiently. If not I could try to post a picture somehow.

    Thanks,

    Mike

Viewing 1 replies (of 1 total)

  • Mike Witt
    Participant

    @mike80222

    OK, well it appears that there is actually no BP template that can be overridden for this situation. I ended up doing it by filtering the code that creates the Friends Tab in the profile. Here’s what I ended up with. If anybody sees anything wrong here, let me know. All this does is create the same tab (a list item) that BP does, except I don’t include the count.

    function filter_bp_friends_tab( $args ) {
        $new_args = '<li id="friends-personal-li" >'
            . '<a id="user-friends" '
            . 'href="' . bp_get_displayed_user_link() . 'friends/">'
            . 'Friends</a></li>';
        return( $new_args );
    }
    add_filter('bp_get_displayed_user_nav_friends', 'filter_bp_friends_tab'); 

    note that the functions like bp_get_displayed_user_link() are defined in the buddypress filebp-members/bp-members-template.php

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.