Skip to:
Content

BuddyPress.org

Opened 14 years ago

Closed 14 years ago

Last modified 10 years ago

#4177 closed defect (bug) (fixed)

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

Reported by: cwidesigns Owned by:
Priority: normal Milestone: 1.6
Component: Templates Version: 1.5.5
Severity: minor 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 14 years ago.
4177-1.6-bleeding.01.patch (1005 bytes ) - added by r-a-y 14 years ago.

Download all attachments as: .zip

Change History (14)

#1 @r-a-y
14 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 14 years ago by r-a-y (previous) (diff)

#2 @r-a-y
14 years ago

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

#3 @boonebgorges
14 years ago

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

#4 @DJPaul
14 years ago

  • Keywords dev-feedback removed
  • Milestone Awaiting Review1.5.6

#5 @r-a-y
14 years ago

  • Keywords has-patch added
  • Severity normalminor

#6 @DJPaul
14 years ago

  • Owner Me? removed
  • Status newassigned

#7 @cwidesigns
14 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
14 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
14 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
14 years ago

  • Milestone 1.5.61.6

This missed the 1.5.6 boat

#11 @djpaul
14 years ago

  • Resolutionfixed
  • Status assignedclosed

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

#12 @DJPaul
10 years ago

  • Component Appearance - Template PartsTemplates
Note: See TracTickets for help on using tickets.