Skip to:

Opened 12 years ago

Closed 10 years ago

#4630 closed defect (bug) (fixed)

Problem with bp_get_name_from_root_slug()

Reported by: danieljuhl's profile DanielJuhl Owned by:
Milestone: 1.7 Priority: normal
Severity: major Version: 1.6.1
Component: Route Parser Keywords:


I'm not sure about this, but as far as I can see there is a problem with this function in BuddyPress v1.6.1.

Right now the page title for the activity directory is simply: " Directory" instead of "Activity Directory".

Line 717 in bp-core/bp-core-template.php

	// Loop through active components and look for a match
	foreach ( $bp->active_components as $component => $id ) {
		if ( !empty( $bp->{$component}->root_slug ) && ( $bp->{$component}->root_slug == $root_slug ) ) {
			return $bp->{$component}->name;

I have a couple of danish installations, and I have created WordPress pages with danish slugs for each component directory and then linked them the settings page.

The problem is then that if I print a $bp->{$component} I see that the root_slug contains the actual root slug used on my site but $root_slug contains the default system slug.

In other words the activity directory would in the above case have: 'activity' == $root_slug
But $bp->{$component}->root_slug would containg "aktiviteter", and "activity" would be in $bp->{$component}->slug

So maybe the code should be changed to, at least that solved my problem:

	// Loop through active components and look for a match
	foreach ( $bp->active_components as $component => $id ) {
		if ( !empty( $bp->{$component}->slug ) && ( $bp->{$component}->slug == $root_slug ) ) {
			return $bp->{$component}->name;

Change History (9)

#1 @DJPaul
12 years ago

  • Milestone changed from Awaiting Review to 1.7

Moving to 1.7 for investigation

#2 @johnjamesjacoby
11 years ago

  • Milestone changed from 1.7 to 1.8

I'm not able to duplicate this on trunk. Punting to 1.8.

#4 @boonebgorges
11 years ago

  • Component changed from Core to Rewrite Rules
  • Milestone changed from 1.8 to 1.9

#5 @boonebgorges
11 years ago

  • Milestone changed from 1.9 to 2.0

#6 @boonebgorges
10 years ago

  • Milestone changed from 2.0 to 2.1

There may be a problem with the underlying bp_get_name_from_root_slug() function, but that'll be largely eliminated with a move to rewrite rules in an upcoming version.

As for the more surface-level problem that led to the discovery of the underlying bug, see #4631, #4726.

#7 @boonebgorges
10 years ago

In 8090:

Improve strings used for <title> and header of directory pages

Our legacy method for creating directory titles involved concatenating the
component name into '% Directory', which did not work well in languages where
a term like 'Groups Directory' would be translated into a single word. In
addition, there was inconistency between the <title> element on directory pages
and the header element used in the page body.

This changeset introduces a 'directory_title' parameter to BP_Core_Component,
so that directories can register a fully localizable string as the title/
header for directories.

To avoid filter name conflicts, the filter names associated with the headers
on group and blog directory pages were changed to _directory_header. See r7942,

See #4726, #4630

Fixes #4631

#8 @DJPaul
10 years ago

  • Milestone changed from 2.1 to 1.7

From my testing, this is fixed. It looks like it was addressed way back in v1.7 in r6616 / #4242.

#9 @DJPaul
10 years ago

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