Skip to:
Content

BuddyPress.org

Opened 4 years ago

Closed 4 years ago

#7475 closed enhancement (maybelater)

Component directory sub pages / slugs

Reported by: modemlooper Owned by:
Milestone: Priority: low
Severity: minor Version: 2.8.2
Component: Route Parser Keywords: 2nd-opinion
Cc:

Description

We can add sub pages / slugs to user component pages with bp_core_new_subnav_item() but not for component directories.

If you add anything extra to url, for example:

/activity/my-extra/

It 404s. We should add a method to BP_Component to register directory sub page same as for the user profile as well as a function like bp_core_new_sub_directory_item();

I've been using something like below to reset the component and then using the action and action vars

function bp_reset_post() {

    $component = bp_current_component();
    $post_data = get_page_by_path( bp_current_action(), OBJECT, 'custom_post_type' );

    if ( ! bp_is_user() && $post_data && BP_CUSTOM_SLUG === $component ) {

        $bp_pages = get_option( 'bp-pages' );
        $page_id = $bp_pages[ $component ];

        bp_theme_compat_reset_post( array(
            'ID'             => $page_id,
            'post_title'     => 'Page Title',
            'post_author'    => 0,
            'post_date'      => 0,
            'post_content'   => '',
            'post_type'      => 'custom_post_type',
            'post_status'    => 'publish',
            'is_archive'     => true,
            'comment_status' => 'closed',
        ) );

        add_filter( 'the_content', 'bp_single_content' );

    }
}
add_action( 'bp_screens', 'bp_reset_post' );

Change History (1)

#1 @DJPaul
4 years ago

  • Component changed from Core to Route Parser
  • Milestone Awaiting Review deleted
  • Resolution set to maybelater
  • Status changed from new to closed

This would be nice but low priority/interest and I think effort spent into working on an update URL routing system would be better.

Note: See TracTickets for help on using tickets.