Skip to:
Content
Pages
Categories
Search
Top
Bottom

Building New Component – Having problem with only one sub nav tab display and actions…


  • Aaron-Nall
    Participant

    @aaron-nall

    Im running WP 3.3.2, BP 1.5.5 on linux at GoDaddy with php 5.x

    Using Skeleton Component 1.6

    My Theme set is Frisco, however it tests with the same result on default BP Theme.

    Briefly…
    All of my sub_nav items are setup the same minus their individual slugs and screens. Every sub_nav works fine accept the first one you see in the code below.

    Symptom…
    The “Activity” tab also receives class=”selected” when the “Tweets” sub_nav is clicked or loaded via the parent screen_function setting.

    This is a huge problem because once the “Activity” tab is double selected with “Twitter” tab you can no longer click Activity and get the activity screen. you have to select a different sub_nav under “Twitter” to get the select off of “Activity”. Then, you can click “Activity” and get that screen.

    I have no Idea why that one sub nav would freak out the Activity tab unless there is something in the “Tweets” sub_nav screen’s contents that makes PB think it’s the activity page. I have completely removed all contents of the screen accept the navigation and it’s still doing the same thing. There is not one reference to activity in the “Tweets” screen.

    Here is the loader code…

    `
    /**
    * Set up your component’s navigation.
    *
    * The navigation elements created here are responsible for the main site navigation (eg
    * Profile > Activity > Mentions), as well as the navigation in the BuddyBar. PE Admin Bar
    * navigation is broken out into a separate method; see
    * BP_Twitter_Component::setup_admin_bar().
    *
    * @global obj $bp
    */
    function setup_nav() {
    $user_id = get_current_user_id();
    if (get_user_meta($user_id, ‘tweetstream_synctoac’, 1)) {
    // Add ‘Twitter’ to the main navigation
    $main_nav = array(
    ‘name’ => __( ‘Twitter’, ‘bp-twitter-interface’ ),
    ‘slug’ => bp_get_twitter_slug(),
    ‘show_for_displayed_user’ => false, // When viewing another user does this nav item show up?
    ‘position’ => 80,
    ‘screen_function’ => ‘bp_twitter_mentions’,
    ‘default_subnav_slug’ => ‘mentions’
    );

    $twitter_link = trailingslashit( bp_loggedin_user_domain() . bp_get_twitter_slug() );

    // Adds the subnav item “Timeline” under the main Twitter tab
    $sub_nav[] = array(
    ‘name’ => __( ‘Tweets’, ‘bp-twitter-interface’ ),
    ‘slug’ => ‘tweets’,
    ‘parent_url’ => $twitter_link,
    ‘parent_slug’ => bp_get_twitter_slug(),
    ‘screen_function’ => ‘bp_twitter_timeline’,
    ‘position’ => 15
    );

    // Adds the subnav item “Mentions” under the main Twitter tab
    $sub_nav[] = array(
    ‘name’ => __( ‘Mentions’, ‘bp-twitter-interface’ ),
    ‘slug’ => ‘mentions’,
    ‘parent_url’ => $twitter_link,
    ‘parent_slug’ => bp_get_twitter_slug(),
    ‘screen_function’ => ‘bp_twitter_mentions’,
    ‘position’ => 20
    );

    // Adds the subnav item “Followers” under the main Twitter tab
    $name = sprintf( __( ‘Followers %s‘, ‘bp-twitter-interface’ ), bp_twitter_followers_count() );
    $sub_nav[] = array(
    ‘name’ => $name,
    ‘slug’ => ‘followers’,
    ‘parent_url’ => $twitter_link,
    ‘parent_slug’ => bp_get_twitter_slug(),
    ‘screen_function’ => ‘bp_twitter_followers’,
    ‘position’ => 30
    );

    // Adds the subnav item “Following” under the main Twitter tab
    $name2 = sprintf( __( ‘Following %s‘, ‘bp-twitter-interface’ ), bp_twitter_following_count() );
    $sub_nav[] = array(
    ‘name’ => $name2,
    ‘slug’ => ‘following’,
    ‘parent_url’ => $twitter_link,
    ‘parent_slug’ => bp_get_twitter_slug(),
    ‘screen_function’ => ‘bp_twitter_following’,
    ‘position’ => 40
    );

    // Adds the subnav item “People” under the main Twitter tab
    // if the user is viewing a Twitter profile
    $sub_nav[] = array(
    ‘name’ => __( ‘People’, ‘bp-twitter-interface’ ),
    ‘slug’ => ‘people’,
    ‘parent_url’ => $twitter_link,
    ‘parent_slug’ => bp_get_twitter_slug(),
    ‘screen_function’ => ‘bp_twitter_people’,
    ‘position’ => 50
    );

    parent::setup_nav( $main_nav, $sub_nav );
    `

    This has been frustrating me for two days now… What the heck am I overlooking?

  • The topic ‘Building New Component – Having problem with only one sub nav tab display and actions…’ is closed to new replies.
Skip to toolbar