2296 | | // 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 ) ) { |
| 2298 | if ( 'wp-signup.php' === basename( $script_name_path ) || ( 'wp-login.php' === basename( $script_name_path ) && ! empty( $_GET['action'] ) && 'register' === $_GET['action'] ) ) { |
| 2299 | $is_wp_signup = true; |
| 2300 | } |
| 2301 | } |
| 2302 | |
| 2303 | // If this is not wp-signup.php, there's nothing to do here. |
| 2304 | if ( ! $is_wp_signup ) { |
| 2305 | return; |
| 2306 | } |
| 2307 | |
| 2308 | /* |
| 2309 | * We redirect wp-signup.php to the registration page except when it's a site signup. |
| 2310 | * In that case, redirect to the BP site creation page if available, otherwise allow |
| 2311 | * access to wp-signup.php. |
| 2312 | */ |
| 2313 | $redirect_to = bp_get_signup_page(); |
| 2314 | |
| 2315 | $is_site_creation = false; |
| 2316 | |
| 2317 | $referer = wp_get_referer(); |
| 2318 | |
| 2319 | // A new site is being added. |
| 2320 | if ( isset( $_POST['stage'] ) && $_POST['stage'] === 'gimmeanotherblog' ) { |
| 2321 | $is_site_creation = true; |
| 2322 | |
| 2323 | // We've arrived at wp-signup.php from my-sites.php. |
| 2324 | } elseif ( $referer ) { |
| 2325 | $referer_path = wp_parse_url( $referer, PHP_URL_PATH ); |
| 2326 | $is_site_creation = false !== strpos( $referer_path, 'wp-admin/my-sites.php' ); |
| 2327 | } |
| 2328 | |
| 2329 | if ( $is_site_creation ) { |
| 2330 | if ( bp_is_active( 'blogs' ) ) { |
| 2331 | $redirect_to = trailingslashit( bp_get_blogs_directory_permalink() . 'create' ); |
| 2332 | } else { |
| 2333 | // Perform no redirect in this case. |
| 2334 | $redirect_to = ''; |
| 2335 | } |
| 2336 | } |
| 2337 | |
| 2338 | if ( ! $redirect_to ) { |