Skip to:
Content

BuddyPress.org

Opened 13 years ago

Closed 13 years ago

Last modified 9 years ago

#4177 closed defect (bug) (fixed)

BP 1.5.x - Issue with bp_loggedin_user_domain() in activity directory template

Reported by: cwidesigns's profile cwidesigns Owned by:
Milestone: 1.6 Priority: normal
Severity: minor Version: 1.5.5
Component: Templates Keywords: has-patch
Cc: webmasters@…

Description

File Affected: wp-content\plugins\buddypress\bp-themes\bp-default\activity\index.php
File (to be) Fixed: wp-content\plugins\buddypress\bp-members\bp-members-template.php

Bug Description: The bp_loggedin_user_domain() fucntion appears to return a value used as a prefix to a "slug" in order to create a complete URL. If the bp_loggedin_user_domain() function returns "", then the current URL (E.g. http://www.example.com/activity/) is used and the slug (in this case the "activity") is tagged onto the end of it. The issue is that if you are already viewing the Activities page for example at http://www.example.com/activity/, then the link's URL becomes http://www.example.com/activity/activity/ and generates a Page Not Found error.

Suggested fall back:

bp-members-template.php
line: 888

function bp_loggedin_user_domain() {

global $bp;

-- return apply_filters( 'bp_loggedin_user_domain', isset( $bp->loggedin_user->domain ) ? $bp->loggedin_user->domain : home_url() . "/" );
}

function bp_loggedin_user_domain() {

global $bp;

++ return apply_filters( 'bp_loggedin_user_domain', isset( $bp->loggedin_user->domain ) ? $bp->loggedin_user->domain : "" );
}

Attachments (2)

4177-1.5-branch.01.patch (866 bytes) - added by r-a-y 13 years ago.
4177-1.6-bleeding.01.patch (1005 bytes) - added by r-a-y 13 years ago.

Download all attachments as: .zip

Change History (14)

#1 @r-a-y
13 years ago

Hi cwidesigns,

You should only be using bp_loggedin_user_domain() when you have confirmed that a user is logged in. That way, you won't run into the issue you explained above.

---

Edit: I see what you mean now in /activity/index.php.

This bug occurs when javascript is disabled or when there is a javascript conflict on the site. You're right that this issue should be addressed, though I don't really recommend falling back to home_url().

Perhaps changing the activity directory template is the best option here. I'll have a patch in a bit.

Edit 2: Looks like this is fixed up for the upcoming version of BP:
http://buddypress.trac.wordpress.org/browser/trunk/bp-themes/bp-default/activity/index.php#L39

Core devs: should this be patched for BP 1.5.x as well?

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

#2 @r-a-y
13 years ago

  • Component changed from Members to Theme
  • Keywords dev-feedback added; has-patch needs-testing removed
  • Summary changed from Issue with bp_loggedin_user_domain() function returning "" to BP 1.5.x - Issue with bp_loggedin_user_domain() in activity directory template

#3 @boonebgorges
13 years ago

r-a-y - Sure, feel free to send a patch.

#4 @DJPaul
13 years ago

  • Keywords dev-feedback removed
  • Milestone changed from Awaiting Review to 1.5.6

#5 @r-a-y
13 years ago

  • Keywords has-patch added
  • Severity changed from normal to minor

#6 @DJPaul
13 years ago

  • Owner Me? deleted
  • Status changed from new to assigned

#7 @cwidesigns
13 years ago

Hey guys, thanks for addressing this, I got busy. My suggestion was a quick one, I didn't review the code to any real degree. I'm changing my username to omarfitzpatrick and hope to get more involved in buddypress patches, features etc. Cheers.

#8 @DJPaul
13 years ago

I think we should avoid theme changes in a 1.5.x release. We have some changes to BP-Default in 1.6, so we should include this in 1.6 too. Bump to 1.6 milestone?

#9 @boonebgorges
13 years ago

DJPaul - Normally, I'd agree with not touching the theme for a bugfix release. But the issue described here is a flat out bug: we should be using root_slug here, or it will totally break on installations with non-standard page slugs. There are no backpat issues; custom themes or child themes that override this file will continue to have a broken link (no further regression), while others will get the fix.

#10 @DJPaul
13 years ago

  • Milestone changed from 1.5.6 to 1.6

This missed the 1.5.6 boat

#11 @djpaul
13 years ago

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

(In [6081]) Correct activity directory permalink in BP-Default. Fixes #4177, props r-a-y

#12 @DJPaul
9 years ago

  • Component changed from Appearance - Template Parts to Templates
Note: See TracTickets for help on using tickets.