Skip to:
Content

BuddyPress.org

Opened 13 years ago

Closed 13 years ago

#3512 closed defect (bug) (fixed)

Problem with 3rd-party root components & bp_modify_page_title()

Reported by: r-a-y's profile r-a-y Owned by:
Milestone: 1.5 Priority: normal
Severity: normal Version:
Component: Core Keywords: has-patch needs-testing
Cc: brajesh@…

Description

If we're on a 3rd-party root component and we're on a single item, bp_modify_page_title() currently looks at:

$bp->bp_options_nav[$bp->current_component][$bp->current_action]['name']

It should change to:

$bp->bp_options_nav[$bp->current_item][$bp->current_action]['name']

Encounted this when I was updating Achievements.

---

I've also changed the title order to be a bit more SEO-friendly for 3rd-party plugins.

Order is now:

component item name | component nav section name | root component name

instead of:

root component name | component item name | component nav section name

Attachments (2)

3512.01.patch (969 bytes) - added by r-a-y 13 years ago.
3512.02.patch (990 bytes) - added by r-a-y 13 years ago.

Download all attachments as: .zip

Change History (16)

@r-a-y
13 years ago

@r-a-y
13 years ago

#1 @r-a-y
13 years ago

02.patch fixes an issue if you have your 3rd-party root component nested under a different page.
eg. 'community/achievements' and not 'achievements'

The patch passes bp_get_root_slug() as a parameter to bp_get_name_from_root_slug().

Might want to add a check for bp_get_root_slug() inside the bp_get_name_from_root_slug() function natively.

Last edited 13 years ago by r-a-y (previous) (diff)

#2 @johnjamesjacoby
13 years ago

  • Keywords needs-testing added
  • Milestone changed from Awaiting Review to 1.5
  • Version 1.5 deleted

Confirmed.

#3 @boonebgorges
13 years ago

r-a-y, this patch doesn't seem to be working for me. Here's what I did:

  • created a new Achievement
  • visited that Achievement's page (so bp_is_single_item() would be true)

The problem is that $bp->bp_options_nav[$bp->current_item] is, in my case, empty. I have not looked more deeply to see why this is the case.

#4 @r-a-y
13 years ago

I've made a few modifications to Achievements to be compatible with BP 1.5, so that's probably the reason.

If you fix the subnav issue in Achievements for BP 1.5, you should encounter my problem. If you want, I can send you my modded version of Achievements so you can check.

#5 @boonebgorges
13 years ago

Yes, please do!

#6 @johnjamesjacoby
13 years ago

Should send it to Paul too, as he's the plugin author that will reap the most reward. :)

#7 @r-a-y
13 years ago

No need to worry, JJJ! I've already sent a patch to Paul :)

#8 @johnjamesjacoby
13 years ago

Cool :)

Do we have any idea how many other plugins might give the same result as what Boone had (where there is something empty?) I'd like to avoid introducing more situations where we change up an existing API that's in use.

#9 @r-a-y
13 years ago

I believe the bug only occurs if the plugin utilizes a root component and registers a subnav with bp_core_new_subnav_item().

EDIT: Also I believe the new component's root slug has to be nested so it resembles something like community/NEW_COMPONENT

The only other plugin (other than Achievements) that fits this criteria is BP Gallery by sbrajesh. I just pinged sbrajesh on Twitter. Let's see if he encounters the bug.

EDIT: BP-Media might be another plugin.

Last edited 13 years ago by r-a-y (previous) (diff)

#10 @sbrajesh
13 years ago

  • Cc brajesh@… added

Hi Ray,
Thanks you for pinging on Twitter.
just confirming this does not affect any of my plugin as none of my previous plugin uses single item(Like attachments/Jet events does). Most of my plugin either uses the directory page or the component page for user(like user/gallery etc). So It does not affect me as of now.

I have been writing a new plugin using the Component API for 1.5 specific, should be complete in a couple of days. I will certainly let you know if I find any issues :)

#11 @fanquake
13 years ago

Thanks for the ping, were on it.

#12 @foxly
13 years ago

Tested against the current BP trunk and we're fully compatible.

#13 @boonebgorges
13 years ago

Thanks for sending the Achievements patch, r-a-y. 3512.02.patch looks good.

Going to close this ticket. If other plugin authors see that there are problems with page titles and/or $bp->bp_options_nav (where some changes took place in this dev cycle that led to the problem reported in this ticket), please reopen the ticket or open a new one with a description. Thanks!

#14 @boonebgorges
13 years ago

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

(In [5076]) Build the page title correctly out of bp_options_nav for third-party root component single items. Fixes #3512. Props r-a-y

Note: See TracTickets for help on using tickets.