Skip to:
Content

BuddyPress.org

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#5199 closed defect (bug) (fixed)

Setting register page as static front page results in duplicate content

Reported by: henrywright Owned by: boonebgorges
Milestone: 1.9 Priority: normal
Severity: normal Version: 1.8.1
Component: Core Keywords: has-patch
Cc:

Description

Setting the BuddyPress registration page as the static front page in WordPress admin results in a duplicate page accessible by both of the following URLs:

example.com/
example.com/register

I'm 95% sure this is unexpected behaviour.

When, for example, the "About" page is set as the static front page - visiting example.com/about will redirect to example.com - hence avoiding duplicated content.

Attachments (2)

5199.patch (675 bytes) - added by boonebgorges 6 years ago.
5199.02.patch (1.5 KB) - added by boonebgorges 6 years ago.

Download all attachments as: .zip

Change History (11)

#1 @boonebgorges
6 years ago

  • Keywords has-patch needs-testing added

Yes, this is unexpected, and it appears that it's the case with all of the component directory pages (Activity, Groups, etc). I think that the right fix is something like 5199.patch, but I would like to get a sanity check from someone else.

@boonebgorges
6 years ago

#2 @henrywright
6 years ago

Hi Boone

I've tested this on a fresh install, 2013 theme and it works well. I did have an issue when I tested on a site with a customised theme and custom functions.php. I was getting a redirect loop on every login attempt. Adding the following hook solved that problem - just thought that was worth mentioning.

function bp_redirect_to_profile() {
	global $bp;
	
	if ( is_user_logged_in() && ( is_front_page() ) ) {
		wp_redirect( $bp->loggedin_user->domain );
		exit();
	}
}
add_action('wp','bp_redirect_to_profile');

#3 @boonebgorges
6 years ago

henrywright - Just to be clear, when you were having the problem with the customized theme, was your front page set to Register? That'd explain the issue, because logged-in users are redirected away from the Register page by default.

#4 @henrywright
6 years ago

Yes, my 'static front page' was set to Register.

#5 @boonebgorges
6 years ago

Thanks for the feedback, henrywright. Would you mind testing 5199.02.patch, which I believe should cover the special case of the register page?

#6 @henrywright
6 years ago

Just gave 5199.02.patch a run through and it works perfectly in all situations I've mentioned above. :)

#7 @boonebgorges
6 years ago

Awesome, thanks for testing!

#8 @boonebgorges
6 years ago

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

In 7437:

Canonical URL detection should be sensitive to page_on_front

When a BP directory is set to page_on_front, it should no longer be accessible
at the regular directory URL (to avoid duplicate URLs for the same content).

A special exception is required for the Register page. Because BP blocks access
to Register for logged-in users, the canonical redirect for Register when
viewed by a logged-in user must be something other than the front page. As in
bp_core_screen_signup(), we use the Members directory in this case (a page we
can be reasonably sure will always be present).

Fixes #5199

#9 @r-a-y
6 years ago

  • Keywords needs-testing removed
  • Milestone changed from Awaiting Review to 1.9
Note: See TracTickets for help on using tickets.