Skip to:
Content

Opened 4 years ago

Closed 3 years ago

#2645 closed defect (bug) (invalid)

define( 'BP_GROUPS_SLUG', 'new_name' )

Reported by: svenl77 Owned by:
Milestone: 1.5 Priority: normal
Severity: Version:
Component: Core Keywords: dev-feedback close
Cc:

Description

My plugin Seo for buddypress breaks in buddypress version 1.2.5.2, and now I'm not sure if this is a buddypress bug, or my problem.

Bevore I start to fix it in the plugin, I would like to know if this could be a bug in buddypress.

If I change the groups slug, the $bp variable still has a component groups, but if you ask for the current component, it gives you the new component slug.

current_component: new_name

In the backend I offer seo optimization based on the components from $bp->[component].

In the frontend I print the meta of the active page according to the $bp->current_component

because these two are different, I do not get the %%tag%% values, and the plugin breaks.

Here is the forum topic to this bug

Change History (7)

comment:2 DJPaul4 years ago

A component's $slug inside the $bp object will match whatever you change it to. If you are looking for the name of the component, e.g. "groups", regardless if the slug has been changed, use $id instead of $slug.

comment:3 svenl774 years ago

Ok, but if I want to know the current_component, I have to use $bp->current_component.  
And this will give me the new slug and not the current component.  
 
For example, If I change the groups slug to "gruppen"
 
current_component:   
gruppen  
 
The Id from groups is groups and not the new slug "gruppen".  
 
groups:   
stdClass Object  
(  

[id] => groups  
[table_name] => wp_bp_groups  
[table_name_members] => wp_bp_groups_members  
[table_name_groupmeta] => wp_bp_groups_groupmeta  
[format_notification_function] => groups_format_notifications  
[slug] => gruppen  

 
...  
 
 
I thought, $bp->current_component should give the current component name and not the slug of the component.  
 
I will change my plugin, to use the slug, and hope, that there won't be plugins, where the   
$bp->current_component is different from the slug.  
 
Thanks Sven

comment:4 svenl774 years ago

ok, I fixed it in my plugin.

I want to say again, Its very confusing to find a slug under $bp->current_component.

There should be the component name not the slug

comment:5 johnjamesjacoby4 years ago

  • Milestone changed from 1.2.6 to 1.3

Could be either way. There's an argument here, but too late to fix for 1.2.6. Punting to 1.3 for further review.

comment:6 boonebgorges3 years ago

  • Keywords dev-feedback close added

That's why BP itself generally checks the current component like this:

if ( $bp->current_component == $bp->groups->slug )

Changing the way that the current component works would break the majority of BP plugins. And the method I've just described, while perhaps not ideal, is perfectly functional. So I see no compelling argument to rework it.

comment:7 boonebgorges3 years ago

  • Resolution set to invalid
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.