Skip to:

Opened 9 years ago

Closed 5 years ago

#6178 closed defect (bug) (fixed)

"Create new site" link in WPMU redirecting to homepage

Reported by: yosmc's profile yosmc Owned by: imath's profile imath
Milestone: 4.3.0 Priority: normal
Severity: normal Version: 2.0.3
Component: Blogs Keywords: has-patch commit


Seems like this bug has been around for years: In a multisite environment, when users are allowed to create additional subsites, activating Buddypress breaks this function. In the dashboard, when you click on "my sites" -> "create new sites" the logged-in user never arrives at the form to actually create a new site, but is redirected to the homepage instead.

PROPOSED FIX - in bp-members-function.php find this (line 2069):

if ( ! empty( $_SERVER['SCRIPT_NAME'] ) && false === strpos( $_SERVER['SCRIPT_NAME'], 'wp-signup.php' ) && ( 'register' != $action ) ) {


if ( ! empty( $_SERVER['SCRIPT_NAME'] ) && ( 'register' != $action ) ) {

That way, new registrations are forwarded to the Buddypress form, while "create new site" is handled by WP Core.

Attachments (5)

6178.patch (901 bytes) - added by imath 9 years ago.
6178.2.patch (693 bytes) - added by imath 8 years ago.
6178.3.patch (1.6 KB) - added by imath 5 years ago.
6178.4.patch (2.1 KB) - added by boonebgorges 5 years ago.
6178.5.patch (2.1 KB) - added by boonebgorges 5 years ago.

Download all attachments as: .zip

Change History (21)

#1 @boonebgorges
9 years ago

Do you have the Blogs component (Site Tracking) enabled? If so, you should be taken to BP's native "Create a Site" page.

If not, we ought to be checking whether Blogs is enabled before hijacking this link.

#2 @imath
9 years ago

This is the kind of situation that would almost make the blogs component a "mu-component".

Applying the 6178.patch should fix the issue reported by yosmc, but then 2 registrations process are "co-existing". There might be no problem at all, but we should really test using both ways to be sure.

9 years ago

#3 @boonebgorges
9 years ago

  • Milestone changed from Awaiting Review to 2.3

Thanks, imath. I don't think it's a huge problem for there to be two different registration processes. It's not as if BP itself is maintaining two separate processes. Instead, we have a blog creation process that we sometimes disable.

Regarding the "mu-component" suggestion: it strikes me that perhaps the "create a site" page should, indeed, always be enabled, but that the blog tracking component doesn't seem like it should be always-on. Perhaps site creation shouldn't be part of the blogs component? Just a thought.

#4 @yosmc
9 years ago

Sorry for the late reply - I thought I would receive automatic notifications for this ticket, but apparently, I don't.

I did not have Site Tracking enabled - when I do enable it, the link to create new sites indeed tries to take me to a page at blogs/create/ which, however doesn't exist. This opens a whole bag of mysteries to me (like why enabling a tracking option would change link locations, or why the new link location doesn't exist, or how to rename the link as the subsites I am creating aren't blogs).

Also there seems to be two schools of thought in this ticket, either that enabling Site Tracking is the way to go or that a patch is needed. Since enabling Site Tracking seems to lead to all kinds of sub-problems that need to be solved as well, I am leaning towards the patch, but at the end of the day I will go with the recommended fix.

#5 @imath
9 years ago

  • Component changed from API - Sign ups & Activation to Component - Blogs
  • Keywords early added
  • Milestone changed from 2.3 to 2.4

As we will be working on the blogs component during 2.4 dev-cycle, i'm moving the ticket to this milestone.

#6 @DJPaul
9 years ago

  • Milestone changed from 2.4 to Future Release

#7 @imath
8 years ago

  • Keywords has-patch added
  • Milestone changed from Future Release to 2.6

Actually i think the problem here is due to the fact arguments used in strpos need to be inversed. 6178.2.patch is doing so, it's then possible to display the wp-signup.php page to let Users create new sites even if the blogs component is not active.

8 years ago

#8 @DJPaul
8 years ago

  • Keywords commit added

@imath I don't know if that patch will fix this issue, but I agree with you it looks like it is the wrong way around.

#9 @imath
8 years ago

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

In 10665:

Multisite: make sure regular users can create new sites when the blogs component is not active.

strpos() function was used the wrong way around, as a result clicking on the "Add new" button at the top of the "My Sites" dashboard page was redirecting the user to root blog home. Using the strpos() function the right way is making sure the user can access to the WordPress signup page and create a new site.

Fixes #6178

#10 @imath
5 years ago

  • Keywords early has-patch commit removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

As reported in #8038, [10665] simply broke the wp-signup.php redirection without really fixing the issue. I'm reopening this ticket to suggest a better way to fix it without breaking the redirection.

5 years ago

#11 @imath
5 years ago

  • Keywords has-patch 2nd-opinion added
  • Milestone changed from 2.6 to 4.3.0

6178.3.patch :

  • brings back the wp-signup.php redirection by default.
  • if the blogs component is not active, it adds an exception, to allow wp-signup.php so that new sites can still be added.

5 years ago

#12 @boonebgorges
5 years ago

Thanks, @imath. 6178.4.patch makes the following changes:

  • Simplify the logic to bail early if this is not a wp-signup.php request.
  • Rename some variables to prevent double-negatives :)
  • When clicking on Add New from my-sites.php and Blogs *is* active, redirect to the BP site creation page instead of /register/ (which goes back to home for logged-in users)

Could you review to make sure I've properly captured the spirit of the ticket?

#13 @imath
5 years ago

Thanks a lot @boonebgorges You captured it :)

There's just one thing I'm wondering. The redirection is also checking for the registration url of regular WordPress site :

So I wonder if we could check the $_GET['action'] earlier.

#14 @boonebgorges
5 years ago

Ah, thanks for that. If we're specifically checking for wp-login.php?action=register, we should not be doing a blanket check for action=register on any page. In this kind of case, it's better to be explicit than to be concise. I've updated the patch accordingly.

5 years ago

#15 @imath
5 years ago

  • Keywords commit added; 2nd-opinion removed

I agree. Thanks a lot for your new patch @boonebgorges I just tested it and it's working as expected 👍

#16 @boonebgorges
5 years ago

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

In 12356:

Improve wp-login and wp-signup redirects.

This changeset restores the following intended behavior:

  1. On non-Multisite, redirect from wp-login.php?action=register to the BP account registration page
  2. On Multisite, redirect from wp-signup.php to the BP "Create a Site" page when the wp-signup.php is intended to trigger new site creation and the Blogs component is enabled
  3. On Multisite, redirect from wp-signup.php to BP's registration in other cases

Props imath.

Fixes #6178. Fixes #8038.

Note: See TracTickets for help on using tickets.