Skip to:
Content
Pages
Categories
Search
Top
Bottom

SubNav Item displayed but redirects to Homepage


  • Roland Fauster
    Participant

    @rfauster

    I am adding a subnav item to my groups (to show screenshots that users uploaded).

    This is the function that does the code:

    if( !defined( 'SCREENSHOT_SLUG' ) )
    define( 'SCREENSHOT_SLUG', 'screenshots' );

    add_action( 'groups_setup_nav', 'cc_groupslugs_add', 3 );
    function el_groups_screenshots_handler() {
    locate_template( array( 'groups/single/home.php'), true);
    }

    function cc_groupslugs_add()
    {
    global $bp;
    if ( $bp->is_single_item ) {
    $group_link = $bp->root_domain . '/' . $bp->groups->slug . '/' . $bp->groups->current_group->slug . '/';

    bp_core_new_subnav_item( array(
    'name' => __( 'Screenshots', 'buddypress' ),
    'slug' => 'screenshots',
    'parent_url' => $group_link,
    'parent_slug' => $bp->groups->slug,
    'screen_function' => 'el_groups_screenshots_handler',
    'position' => 30,
    'user_has_access' => $bp->groups->current_group->user_has_access,
    'item_css_id' => 'screenshots'
    ) );
    }

    }

    in gourps/single/home.php I am doing this to display the correct theme template

    <?php elseif ( SCREENSHOT_SLUG == $bp->current_component ) : ?>
    <?php locate_template( array( 'groups/single/screenshots.php'), true) ?>

    The Navigation is displayed properly but when I click it, it redirects me to my homepage rather than to the correct template (which is not currupt and existent on the server).

    Am I doing something wrong here or forgetting something??

  • The topic ‘SubNav Item displayed but redirects to Homepage’ is closed to new replies.
Skip to toolbar