[buddypress-trac] [BuddyPress] #3461: Problem With bp_is_current_component when a Component needs multiple Top level pages(Directory pages)

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Tue Aug 9 21:30:14 UTC 2011


#3461: Problem With bp_is_current_component when a Component  needs multiple Top
level pages(Directory pages)
-------------------------+-----------------------------
 Reporter:  sbrajesh     |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Core         |    Version:  1.5
 Severity:  minor        |   Keywords:
-------------------------+-----------------------------
 In Bp 1.2.x when we used bp_core_add_root_component( "my_slug_1"
 ),bp_core_add_root_component( "my_slug_2" ), we were able to have two top
 level directory pages where we could check using
 $bp->current_component=='some_slug_1)'/bp_is_apge('some_slug_1') and so
 on.

 It means, Even if there was a single component, we could use multiple top
 level directory pages.

 After the changes in bp 1.5, specifically #3428, The
 bp_core_add_root_component("some_slug_1") assumes that we have already
 registered a component with the slug name and It test for $bp->some_slug_1
 and $bp->some_slug_2. If That is not found, It won't create the pages as
 per the code in the bp_core_add_root_component

 `
 if ( isset( $bp->{$slug} ) ) {
                 $bp->loaded_components[$bp->{$slug}->slug] =
 $bp->{$slug}->id;
                 $bp->{$slug}->has_directory = true;
         }
 `

 So, if we try to check bp_is_current_component('some_slug_1'), It will
 fail if the some_Slug_1 is not registered as a component in $bp global
 variable(and I believe , It is right to do so, after all we want to check
 for a directory poage, so current component failure is not an issue).

 I tried to use bp_is_page('some_slug1') but that fails too(It uses
 bp_is_current_component).

 Is there any reliable way to use multiple directory pages(top level pages)
 with a component and test for the current page. Like if the
 current_page_slug is xyz . I just wanted to know if there is anyway to
 find out a top level page(like we used to have in bp 1.2.x) without
 registering each page as a component.


 Thanks

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/3461>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list