Changeset 11335
- Timestamp:
- 11/18/2021 01:47:58 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-hooks.php
r11333 r11335 19 19 add_filter( 'old_slug_redirect_post_id', array( $this, 'disable_wp_old_slug_redirect' ) ); 20 20 add_action( 'template_redirect', array( $this, 'redirect_update_php_page' ) ); 21 add_action( 'template_redirect', array( $this, 'redirect_legacy_urls' ) );21 add_action( 'template_redirect', array( $this, 'redirect_legacy_urls' ), 5 ); 22 22 add_action( 'template_redirect', array( $this, 'redirect_ask_question_plugin_forum' ) ); 23 23 add_filter( 'wp_insert_post_data', array( $this, 'set_post_date_gmt_for_pending_posts' ) ); … … 319 319 public function redirect_legacy_urls() { 320 320 global $wp_query, $wp; 321 322 // A user called 'profile' exists, but override it. 323 if ( 'profile' === get_query_var( 'bbp_user' ) ) { 324 if ( is_user_logged_in() ) { 325 $user = wp_get_current_user(); 326 $url = str_replace( '/profile/', "/{$user->user_nicename}/", $_SERVER['REQUEST_URI'] ); 327 } else { 328 $url = wp_login_url( home_url( $wp->request ) ); 329 } 330 331 wp_safe_redirect( $url ); 332 exit; 333 } 321 334 322 335 if ( ! is_404() ) { … … 345 358 } 346 359 347 if ( 'profile' === get_query_var( 'bbp_user' ) ) {348 if ( is_user_logged_in() ) {349 $user = wp_get_current_user();350 $url = str_replace( '/profile/', "/{$user->user_nicename}/", $_SERVER['REQUEST_URI'] );351 } else {352 $url = wp_login_url( home_url( $wp->request ) );353 }354 355 wp_safe_redirect( $url );356 exit;357 }358 360 } 359 361
Note: See TracChangeset
for help on using the changeset viewer.