Skip to content

Instantly share code, notes, and snippets.

@shanebp
Last active June 28, 2023 18:11
Show Gist options
  • Select an option

  • Save shanebp/5d3d2f298727a0a036e5 to your computer and use it in GitHub Desktop.

Select an option

Save shanebp/5d3d2f298727a0a036e5 to your computer and use it in GitHub Desktop.

Revisions

  1. shanebp renamed this gist Apr 7, 2016. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion gistfile1.php → bp-profile-tab-and-subnav.php
    Original file line number Diff line number Diff line change
    @@ -37,11 +37,15 @@ function add_animal_tabs() {


    function animals_screen() {
    add_action( 'bp_template_title', 'animals_screen_title' );
    add_action( 'bp_template_content', 'animals_screen_content' );
    bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
    }
    function animals_screen_title() {
    echo 'Animals Title<br/>';
    }
    function animals_screen_content() {
    echo 'Animals<br/>';
    echo 'Animals Content<br/>';
    }


  2. shanebp revised this gist May 21, 2015. 1 changed file with 7 additions and 7 deletions.
    14 changes: 7 additions & 7 deletions gistfile1.php
    Original file line number Diff line number Diff line change
    @@ -2,13 +2,13 @@ function add_animal_tabs() {
    global $bp;

    bp_core_new_nav_item( array(
    'name' => 'Animals',
    'slug' => 'animals',
    'parent_url' => $bp->displayed_user->domain,
    'parent_slug' => $bp->profile->slug,
    'screen_function' => 'animals_screen',
    'position' => 200,
    'default_subnav_slug' => 'animals'
    'name' => 'Animals',
    'slug' => 'animals',
    'parent_url' => $bp->displayed_user->domain,
    'parent_slug' => $bp->profile->slug,
    'screen_function' => 'animals_screen',
    'position' => 200,
    'default_subnav_slug' => 'animals'
    ) );

    bp_core_new_subnav_item( array(
  3. shanebp created this gist May 21, 2015.
    62 changes: 62 additions & 0 deletions gistfile1.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,62 @@
    function add_animal_tabs() {
    global $bp;

    bp_core_new_nav_item( array(
    'name' => 'Animals',
    'slug' => 'animals',
    'parent_url' => $bp->displayed_user->domain,
    'parent_slug' => $bp->profile->slug,
    'screen_function' => 'animals_screen',
    'position' => 200,
    'default_subnav_slug' => 'animals'
    ) );

    bp_core_new_subnav_item( array(
    'name' => 'Dogs',
    'slug' => 'dogs',
    'parent_url' => trailingslashit( bp_displayed_user_domain() . 'animals' ),
    'parent_slug' => 'animals',
    'screen_function' => 'dogs_screen',
    'position' => 100,
    'user_has_access' => bp_is_my_profile()
    ) );

    bp_core_new_subnav_item( array(
    'name' => 'Cats',
    'slug' => 'cats',
    'parent_url' => trailingslashit( bp_displayed_user_domain() . 'animals' ),
    'parent_slug' => 'animals',
    'screen_function' => 'cats_screen',
    'position' => 150,
    'user_has_access' => bp_is_my_profile()
    ) );

    }
    add_action( 'bp_setup_nav', 'add_animal_tabs', 100 );



    function animals_screen() {
    add_action( 'bp_template_content', 'animals_screen_content' );
    bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
    }
    function animals_screen_content() {
    echo 'Animals<br/>';
    }


    function dogs_screen() {
    add_action( 'bp_template_content', 'dogs_screen_content' );
    bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
    }
    function dogs_screen_content() {
    echo 'Dogs';
    }

    function cats_screen() {
    add_action( 'bp_template_content', 'cats_screen_content' );
    bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
    }
    function cats_screen_content() {
    echo 'Cats';
    }