Skip to:
Content

Opened 18 months ago

Last modified 7 weeks ago

#4630 new defect (bug)

Problem with bp_get_name_from_root_slug()

Reported by: DanielJuhl Owned by:
Milestone: 2.1 Priority: normal
Severity: major Version: 1.6.1
Component: Rewrite Rules Keywords:
Cc:

Description

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 (7)

comment:1 DJPaul18 months ago

  • Milestone changed from Awaiting Review to 1.7

Moving to 1.7 for investigation

comment:2 johnjamesjacoby17 months ago

  • Milestone changed from 1.7 to 1.8

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

comment:4 boonebgorges11 months ago

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

comment:5 boonebgorges5 months ago

  • Milestone changed from 1.9 to 2.0

comment:6 boonebgorges7 weeks 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.

comment:7 boonebgorges7 weeks 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

Note: See TracTickets for help on using tickets.