Skip to:
Content
Pages
Categories
Search
Top
Bottom

Remove Following & Followers from Profile Nav (bp_setup_nav)


  • shanebp
    Moderator

    @shanebp

    I need to remove “Following” and “Followers” from the Profile nav.
    I can remove other links using the function below in bp-custom.php
    But Follow links still appear.
    I’ve tried various priority values.
    Perhaps I am calling the wrong tag in the add_action ?
    `
    function sc_remove_nav_tabs() {
    /* works great */
    bp_core_remove_nav_item( ‘events’ );
    bp_core_remove_nav_item( ‘friends’ );
    bp_core_remove_subnav_item( ‘activity’, ‘friends’ );

    /* doesn’t work*/
    bp_core_remove_nav_item( ‘followers’ );
    bp_core_remove_nav_item( ‘following’ );
    bp_core_remove_subnav_item( ‘activity’, ‘following’ );

    }
    add_action( ‘bp_setup_nav’, ‘sc_remove_nav_tabs’, 15 );
    //add_action( ‘xprofile_setup_nav’, ‘sc_remove_nav_tabs’ );
    `

    Also tried, without success:
    bp_core_remove_subnav_item( $bp->activity->slug, ‘following’ );

Viewing 4 replies - 1 through 4 (of 4 total)

  • shanebp
    Moderator

    @shanebp

    There is probably a better way to do this, but this works:

    In bp-follow.php, remove or comment out the action calls to ‘bp_follow_setup_nav’ at around Line 80.


    Nahum
    Participant

    @nahummadrid

    I also am trying to figure this out, without commenting out the plugin file.
    `
    bp_core_remove_new_nav_item( ‘followers’ );
    bp_core_remove_new_nav_item( ‘following’ );
    `
    also doesn’t work


    r-a-y
    Keymaster

    @r-a-y

    @shanebp, @nahummadrid – The problem is BP Follow uses an older method to add items to the nav. The plugin needs to be updated to use the newer BP conventions; I’m thinking of asking Andy for contributor access.

    In the meantime, you need to make sure your code runs after BP Follow.

    Change:
    `add_action( ‘bp_setup_nav’, ‘sc_remove_nav_tabs’, 15 );`

    to

    `add_action( ‘init’, ‘sc_remove_nav_tabs’, 15 );`

    And it should work.


    shanebp
    Moderator

    @shanebp

    Thanks for the tip – works here.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Remove Following & Followers from Profile Nav (bp_setup_nav)’ is closed to new replies.
Skip to toolbar