#4177 closed defect (bug) (fixed)
BP 1.5.x - Issue with bp_loggedin_user_domain() in activity directory template
Reported by: | 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)
Change History (14)
#2
@
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
#7
@
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
@
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
@
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.
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?