[buddypress-trac] [BuddyPress Trac] #7475: Component directory sub pages / slugs
buddypress-trac
noreply at wordpress.org
Tue Mar 21 22:18:40 UTC 2017
#7475: Component directory sub pages / slugs
-------------------------+-----------------------------
Reporter: modemlooper | Owner:
Type: enhancement | Status: new
Priority: low | Milestone: Awaiting Review
Component: Core | Version: 2.8.2
Severity: minor | Keywords: 2nd-opinion
-------------------------+-----------------------------
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' );
}}}
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7475>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list