Skip to:
Content

Opened 3 years ago

Closed 3 years ago

#3582 closed defect (bug) (fixed)

Browser title for a component's directory only displays the word 'Directory'

Reported by: masonjames Owned by:
Milestone: 1.5 Priority: normal
Severity: normal Version: 1.5
Component: Core Keywords: has-patch dev-feedback
Cc:

Description

Using 5348 from trunk and default theme, most of the BuddyPress component pages have browser titles such as 'Members Directory', 'Activity Streams Directory, and 'Discussion Forms Directory'.

For Groups, however, I'm only seeing 'Directory'. Not sure if this is a theme or plugin issue though. I tested a couple themes and found the same result on each - though the other themes are based on the default for 1.5.

At any rate, it should read 'Group Directory' to follow the pattern.

Attachments (2)

3582.01.patch (1.3 KB) - added by r-a-y 3 years ago.
3582.02.patch (1.4 KB) - added by boonebgorges 3 years ago.

Download all attachments as: .zip

Change History (14)

comment:1 masonjames3 years ago

  • Summary changed from Browser title for 'Groups Directory' only displays the word 'Directory' to Browser title for 'Group Directory' only displays the word 'Directory'
Version 0, edited 3 years ago by masonjames (next)

comment:2 r-a-y3 years ago

I've found this happens if:

  • My root pages are nested (eg. 'community/members', 'community/groups')
  • Or if I'm using a custom BP_X_SLUG define.

comment:3 r-a-y3 years ago

  • Summary changed from Browser title for 'Group Directory' only displays the word 'Directory' to Browser title for a component's directory only displays the word 'Directory'

comment:4 masonjames3 years ago

OK, digging further into this it seems to happen anytime you're using a custom slug (as r-a-y mentions).

I had the groups slug as groups-2 because an earlier page was in the trash. Deleting the old page and changing the slug to 'groups' I now get 'User Groups Directory' for the browser title.

comment:5 DJPaul3 years ago

  • Milestone changed from Awaiting Review to 1.5
  • Severity changed from trivial to normal

Confirmed. It's not getting the component name from the root_slug in the page title filter.

r-a-y3 years ago

comment:6 r-a-y3 years ago

  • Component changed from Theme to Core
  • Keywords has-patch added

Problem was in bp_get_root_slug().

$component_name was using the active component's array value, which is always '1' if it is active. So I removed this variable and replaced $component_name with $component.

comment:7 DJPaul3 years ago

  • Keywords dev-feedback added

I was just looking at this, and about to add a patch with the same fix. I want another opinion about changing bp_get_root_slug(); its also used in bp_get_options_nav()

comment:8 r-a-y3 years ago

This could potentially be a 3rd-party plugin problem.

Since $component_name circa 1.2.x used to be an alphabetical string, for backpat, we can check if $component_name isn't numeric, if so, use that value?

comment:9 boonebgorges3 years ago

This is another change that stems from the fact that $bp->active_components and $bp->loaded_components were jumbled at some point during the dev cycle.

As for bp_get_options_nav(), this change will have no effect. It turns out that $bp->displayed_user is *never* empty, so the "then" condition of the ternary operator is never called. This is either due to a logic error of mine at one point, or due to more recent changes in BuddyPress. At the moment, the logic error doesn't matter, because the way that component ids are indexed has also changed since that point - so, in contrast to what the comment says, you don't actually ever need the root_slug. We should open a ticket to look at this after 1.5, but for now I don't want to touch it because it's working. In any case, 3582.01.patch will have no effect on it.

r-a-y: Good call. (Except that a straight numeric check won't work, because those 1s are strings.) See 3582.02.patch.

boonebgorges3 years ago

comment:10 r-a-y3 years ago

Looks like that should work!

comment:11 DJPaul3 years ago

Patch works here

comment:12 boonebgorges3 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [5153]) Ensures that bp_get_root_slug() gets the proper root_slug when searching in active_components. Ensures that the title of component directories is correct when the component slug has been changed from the default. Fixes #3582. Props r-a-y

Note: See TracTickets for help on using tickets.