Changeset 11330 for sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-hooks.php
- Timestamp:
- 11/17/2021 06:12:18 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-hooks.php
r11313 r11330 313 313 * Redirect legacy urls to their new permastructure. 314 314 * - /users/$id & /profile/$slug to /users/$slug 315 * - /users/my-profile/* => /users/$slug/* 315 316 * 316 317 * See also: Support_Compat in inc/class-support-compat.php 317 318 */ 318 319 public function redirect_legacy_urls() { 319 global $wp_query ;320 global $wp_query, $wp; 320 321 321 322 if ( ! is_404() ) { … … 342 343 exit; 343 344 } 345 } 346 347 if ( 'my-profile' === get_query_var( 'bbp_user' ) ) { 348 if ( is_user_logged_in() ) { 349 $user = wp_get_current_user(); 350 $url = str_replace( '/my-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 ); 344 356 } 345 357 }
Note: See TracChangeset
for help on using the changeset viewer.