| 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 | } |