Skip to:
Content

BuddyPress.org

Opened 10 months ago

Last modified 5 months ago

#9128 assigned defect (bug)

Subnavs slug prefixing

Reported by: raviousprime's profile raviousprime Owned by: imath's profile imath
Milestone: Awaiting Review Priority: low
Severity: normal Version: 12.0.0
Component: Core Keywords:
Cc:

Description

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

        $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.

Change History (4)

#1 @espellcaste
7 months ago

  • Milestone changed from Awaiting Review to Up Next

@imath can you tell if that's possibly a bug?

#2 @imath
7 months ago

  • Owner set to imath
  • Status changed from new to assigned

Thanks, I will look at it 👌

#3 @imath
7 months ago

  • Milestone changed from Up Next to 15.0.0

#4 @espellcaste
5 months ago

  • Milestone changed from 15.0.0 to Awaiting Review
  • Priority changed from normal to low
Note: See TracTickets for help on using tickets.