Skip to:
Content
Pages
Categories
Search
Top
Bottom

Changing default_subnav_slug for Activity

  • @liping

    Member

    Short of changing core buddypressbp-activity.php, I haven’t been able to change the activity’s default_subnav_slug from Personal to Friends.

    Does anyone have a clue?

    I’m copied the whole bp_activity_setup_nav (from bp-activity.php) into a custom function inside the theme’s functions.php

    function my_bp_activity_setup_nav {

    global $bp;

    bp_core_remove_nav_item(‘activity’);

    bp_core_new_nav_item( array( ‘name’ => __( ‘Activity’, ‘buddypress’ ), ‘slug’ => $bp->activity->slug, ‘position’ => 10, ‘screen_function’ => ‘bp_activity_screen_friends’, ‘default_subnav_slug’ => ‘friends’, ‘item_css_id’ => $bp->activity->id ) );

    // rest of original bp_activity_setup_nav but with subnav positions changed
    }
    add_action( ‘wp’, ‘my_bp_activity_setup_nav’);

    This did not work. I’m at a total lost because the changed subnav item positions in my_bp_activity_setup_nav() is reflected. Just not the default_subnav_slug / screen_function for Activity.

Viewing 10 replies - 1 through 10 (of 10 total)
  • @mercime

    Participant

    @liping

    Member

    I have no wish to change the slug or labels.
    What I want is to change the default subnav slug for Activity.

    Currently http://yoursite/members/myaccount/activity/ defaults to Personal.

    I want to change this to default to Friends instead.

    @liping

    Member

    Bump, anyone?

    @liping

    Member

    I loathe to bump this, but I really really don’t want to hack core files to do this. Anyone?

    @hamedhemmati

    Participant

    I would like to do something similar as well. I want the default landing page to be different for when the user is visiting the page from when another user is visiting the page. So far haven’t found anything that would point to how you can change the default landing page.

    @liping

    Member

    I finally figured it out (took way too long).
    Here are the code snippets to be placed in bp-custom.php (NOT functions.php, my fatal hair-tearing mistake).

    `
    /** wp-content/plugins/bp-custom.php **/
    function my_change_activity_default_subnav() {
    global $bp;
    if (bp_is_my_profile()) {
    bp_core_new_nav_default(array( ‘parent_slug’ => $bp->activity->slug, ‘screen_function’ => ‘bp_activity_screen_friends’, ‘subnav_slug’ => $bp->friends->slug));
    }
    }
    add_action( ‘bp_setup_nav’, ‘my_change_activity_default_subnav’ );

    function my_change_activity_subnav_sequence() {
    global $bp;
    if (bp_is_my_profile()) {
    // flip just-me and friends positions
    $bp->bp_options_nav = ’20’;
    $bp->bp_options_nav = ’10’;
    }
    }
    add_action( ‘bp_activity_setup_nav’, ‘my_change_activity_subnav_sequence’ );
    `

    @rogercoathup

    Participant

    @liping – was about to post that this may need to go into bp-custom.php rather than functions.php

    This order of invocation issue should really be addressed. Changes like tab orders, removing tabs, etc. should be theme specific – i.e. you may want to run a site where you switch themes – with the presence or not of tabs being determined by the theme.

    Unfortunately, needing these things to be in bp-custom.php means they affect all themes, not just the one you want it for.

    Anyway, thanks for the heads up on bp_core_new_nav_default() function… I’d removed the general tab from settings… and was searching for a way to remove the default link to it that still remained.

    @rogercoathup

    Participant

    … unfortunately, we’ve not been able to get this to work with the settings menu… will post separately

    @ankurm

    Member

    @liping
    It worked perfect!
    Thanks :)

    @abysshorror

    Member
Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Changing default_subnav_slug for Activity’ is closed to new replies.
Skip to toolbar