Skip to:
Content

BuddyPress.org

Ticket #6178: 6178.3.patch

File 6178.3.patch, 1.6 KB (added by imath, 7 years ago)
  • src/bp-members/bp-members-functions.php

    diff --git src/bp-members/bp-members-functions.php src/bp-members/bp-members-functions.php
    index 12a4c8432..3900e35a1 100644
    function bp_core_wpsignup_redirect() { 
    22912291                return;
    22922292        }
    22932293
    2294         $action = !empty( $_GET['action'] ) ? $_GET['action'] : '';
     2294        $action = '';
     2295        if ( ! empty( $_GET['action'] ) ) {
     2296                $action = $_GET['action'];
     2297        }
     2298
     2299        $is_wp_signup = false;
     2300        if ( ! empty( $_SERVER['SCRIPT_NAME'] ) ) {
     2301                $script_name_path = wp_parse_url( $_SERVER['SCRIPT_NAME'], PHP_URL_PATH );
     2302                $is_wp_signup     = ltrim( $script_name_path, '/' ) === 'wp-signup.php';
     2303        }
     2304
     2305        // By default WP Core signup is redirected.
     2306        $signup_no_redirect = false;
     2307
     2308        // Unless the blogs component is not active, adding new sites must be allowed.
     2309        if ( $is_wp_signup && ! bp_is_active( 'blogs' ) ) {
     2310                $is_new_site_stage = false;
     2311                $referer           = wp_get_referer();
     2312
     2313                // A new site is being added.
     2314                if ( isset( $_POST['stage'] ) && $_POST['stage'] === 'gimmeanotherblog' ) {
     2315                        $signup_no_redirect = true;
     2316
     2317                // Check if the user requests a new site.
     2318                } elseif ( $referer ) {
     2319                        $referer_path       = wp_parse_url( $referer, PHP_URL_PATH );
     2320                        $signup_no_redirect = false !== strpos( $referer_path, 'wp-admin/my-sites.php' );
     2321                }
     2322        }
    22952323
    22962324        // Not at the WP core signup page and action is not register.
    2297         if ( ! empty( $_SERVER['SCRIPT_NAME'] ) && false === strpos( 'wp-signup.php', $_SERVER['SCRIPT_NAME'] ) && ( 'register' != $action ) ) {
     2325        if ( ( ! $is_wp_signup || $signup_no_redirect ) && 'register' !== $action ) {
    22982326                return;
    22992327        }
    23002328