Changeset 12356
- Timestamp:
- 03/11/2019 06:58:06 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-members/bp-members-functions.php
r12349 r12356 2292 2292 } 2293 2293 2294 $action = !empty( $_GET['action'] ) ? $_GET['action'] : ''; 2295 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 ) ) { 2294 $is_wp_signup = false; 2295 if ( ! empty( $_SERVER['SCRIPT_NAME'] ) ) { 2296 $script_name_path = wp_parse_url( $_SERVER['SCRIPT_NAME'], PHP_URL_PATH ); 2297 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 ) { 2298 2305 return; 2299 2306 } 2300 2307 2301 bp_core_redirect( bp_get_signup_page() ); 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 ) { 2339 return; 2340 } 2341 2342 bp_core_redirect( $redirect_to ); 2302 2343 } 2303 2344 add_action( 'bp_init', 'bp_core_wpsignup_redirect' );
Note: See TracChangeset
for help on using the changeset viewer.