[buddypress-trac] [BuddyPress Trac] #9128: Subnavs slug prefixing
buddypress-trac
noreply at wordpress.org
Fri Mar 29 19:55:26 UTC 2024
#9128: Subnavs slug prefixing
--------------------------+-----------------------------
Reporter: raviousprime | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Core | Version: 12.0.0
Severity: normal | Keywords:
--------------------------+-----------------------------
Hello,
I am facing an issue while trying to add BuddyPress 12 compatibility to my
plugin.
Earlier, we used the following URL structure(with screen callbacks) and
they worked
1. http://example.com/members/user-name/component-name/some-slug/
2. http://example.com/members/user-name/component-name/type/some-slug
Both of these worked earlier('type' is a fixed string).
I am unable to get the 2nd URL working with BP 12.0+. Is it a bug in the
new rewrite API? or am I missing something?
Here is what I have done
{{{#!php
<?php
$user_domain = bp_is_user() ? bp_displayed_user_domain() :
bp_loggedin_user_domain();
$parent_url = trailingslashit( $user_domain . $this->slug );
$sub_nav[] = array(
'name' => 'My Gallery',
'slug' => 'my-galleries',
'parent_url' => $parent_url,
'parent_slug' => $this->slug,
'screen_function' => array( $this, 'render_my_gallery' ),
'position' => 10,
'item_css_id' => 'gallery-my-gallery',
);
$supported_types = array(
'photo' => 'Photo',
'video' => 'Video',
);
$i = 0;
foreach ( $supported_types as $type => $label ) {
$sub_nav[] = array(
'name' => $label,
'slug' => 'type/' . $type,
'parent_url' => $parent_url,
'parent_slug' => $this->slug,
'screen_function' => array( $this,
'render_gallery_by_type' ),
'position' => 20 + $i,
);
$i = $i + 10; // increment the position.
}
}}}
Thank you for your assistance.
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/9128>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list