WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 2 years ago

#35422 new enhancement

only exit if the redirect is true when registering on multisites

Reported by: pbearne Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Login and Registration Keywords: has-patch
Focuses: multisite Cc:

Description

in wp-login.php we do a redirect to (wp_signup_location wp-signup.php) when registering on multi sites and die

we should only die if the redirect is true

I also want to this patch added to save me from having to edit a core file inorder to install s2member on multisite

This plugin has install instructions that have us rem out the redirect and exit `

<?php
case 'register' :
    if ( is_multisite() ) {
        $sign_up_url = network_site_url( 'wp-signup.php' );
        // Multisite uses wp-signup.php
        // Modified for full plugin compatiblity.
        //wp_redirect( apply_filters( 'wp_signup_location', $sign_up_url ) );
        //exit;
    }

` I would like to change this to use the filter to remove the location and cause the wp_redirect to return false

Attachments (4)

wp-login.php.patch (516 bytes) - added by pbearne 2 years ago.
patch
wp-login.php.2.patch (762 bytes) - added by pbearne 2 years ago.
patch with both filters
wp-login.php.3.patch (882 bytes) - added by pbearne 2 years ago.
Lets try that with some comments :-)
wp-login.php.4.patch (878 bytes) - added by pbearne 2 years ago.
with the extra the in doc block removed

Download all attachments as: .zip

Change History (15)

@pbearne
2 years ago

patch

#1 @pbearne
2 years ago

  • Keywords has-patch needs-codex dev-feedback added

#2 @ericlewis
2 years ago

  • Focuses multisite added

#3 @swissspidy
2 years ago

  • Keywords needs-codex removed

#5 @jeremyfelt
2 years ago

  • Keywords dev-feedback removed

This is a duplicate of #23349, which was closed as invalid, though possibly due to a lack of discussion.

I'm still wary of this as a method to allow user registration at the individual site level of a network and would rather see plugins create a registration form. It seems like something could also be done using the login_form_register action rather than by editing core files.

#6 @pbearne
2 years ago

My main aim here to remove the need to patch core

Let do some more digging as to what the plugin is doing

#7 @JasWSInc
2 years ago

I'm the lead at s2Member. Thank you all for taking a look at this.

Without diving deep into the assortment of hooks/filters that s2Member uses to make this feasible, because it's not just this one in particular that is required for it all to come together; let me just say that what would really help is to give plugin developers a way to prevent this redirection and exit when desirable.

Here is what's in core right now.

<?php
case 'register' :
        if ( is_multisite() ) {
                /**
                 * Filter the Multisite sign up URL.
                 *
                 * @since 3.0.0
                 *
                 * @param string $sign_up_url The sign up URL.
                 */
                wp_redirect( apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) ) );
                exit;
        }

Proposed addition of a new filter: require_wp_signup

<?php
case 'register' :
        if ( apply_filters( 'require_wp_signup', is_multisite() ) ) {
                /**
                 * Filter the Multisite sign up URL.
                 *
                 * @since 3.0.0
                 *
                 * @param string $sign_up_url The sign up URL.
                 */
                wp_redirect( apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) ) );
                exit;
        }

@pbearne
2 years ago

patch with both filters

#8 @pbearne
2 years ago

@JasWSInc I have added your suggested filter to the patch

Thank you for hoping in on these tickets I really what to get all the patchs ing so you can remove the need to patch core

Please look at the other ticket in the set to make sure that this will work for you.

Many thanks paul

@pbearne
2 years ago

Lets try that with some comments :-)

This ticket was mentioned in Slack in #core by chriscct7. View the logs.


2 years ago

#10 @DrewAPicture
2 years ago

  • Milestone changed from Awaiting Review to Future Release

@pbearne In wp-login.php.3.patch: "the the"

@pbearne
2 years ago

with the extra the in doc block removed

#11 @chriscct7
2 years ago

  • Version trunk deleted
Note: See TracTickets for help on using tickets.