Opened 10 years ago
Closed 10 years ago
#5883 closed defect (bug) (worksforme)
bp_core_new_nav_item does not work with a hyphen in the slug
Reported by: | zudie | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 2.0.3 |
Component: | Route Parser | Keywords: | reporter-feedback |
Cc: |
Description
Adding an extra page to the Profile menu. The following code works:
bp_core_new_nav_item( array( 'name' => 'My Lot', 'slug' => 'mylot', 'parent_url' => $bp->loggedin_user->domain . $bp->members->slug . '/', 'parent_slug' => $bp->members->slug, 'default_subnav_slug' => 'mylot', 'position' => 80, 'show_for_displayed_user' => true, 'screen_function' => 'im_my_lot_nav', 'item_css_id' => 'mylot' ));
Now if I change the slug to 'my-lot' the page isn't found anymore and the Members List is displayed instead.
Change History (5)
#3
@
10 years ago
- Keywords good-first-bug added
A more challenging ticket to work on, but a good one if you want to learn a little about how BP's routing works.
#4
@
10 years ago
- Keywords reporter-feedback added; good-first-bug removed
Well, i think there's no bug.
First zudie, you are mixing arguments that are used in bp_core_new_subnav_item()
within bp_core_new_nav_item()
which is not a big deal as BuddyPress will keep the good ones :)
Then, i wasn't able to reproduce, everything works fine with an hyphen in the slug.
I've created this gist to illustrate how to use the two nav functions. You can use it to test eveything is ok.
https://gist.github.com/imath/2b8806431cc7a6f39f74
Haven't tested but would like for us to fix this in 2.2 because I think most people would expect a hyphen to work in a slug field (they normally do).