Changeset 9174
- Timestamp:
- 10/11/2019 02:57:44 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/buddypress.org/public_html/wp-content/plugins/buddypress-org/extensions.php
r8051 r9174 157 157 if ( (bool) strstr( $_SERVER['HTTP_HOST'], 'buddypress' ) && ! is_admin() && defined( 'WP_USE_THEMES' ) && WP_USE_THEMES ) { 158 158 add_action( 'init', 'bporg_redirect', 1 ); // before bp_init 159 }160 161 function wporg_profiles_redirect() {162 $uri_chunks = explode( '/', trim( $_SERVER['REQUEST_URI'], '/' ) );163 if ( 'users' == $uri_chunks[0] ) {164 if ( ! empty( $uri_chunks[1] ) ) {165 wp_redirect( 'https://profiles.wordpress.org/' . $uri_chunks[1] . '/', 301 );166 } else {167 wp_redirect( 'https://wordpress.org/' );168 }169 exit;170 }171 172 if ( get_user_by( 'slug', $uri_chunks[0] ) ) {173 return;174 }175 176 if ( $user = get_user_by( 'login', urldecode( $uri_chunks[0] ) ) ) {177 wp_redirect( 'https://profiles.wordpress.org/' . $user->user_nicename . '/', 301 );178 exit;179 } elseif ( $user = get_user_by( 'login', str_replace( ' ', '', urldecode( $uri_chunks[0] ) ) ) ) {180 wp_redirect( 'https://profiles.wordpress.org/' . $user->user_nicename . '/', 301 );181 exit;182 }183 184 // For strange reasons, BP uses 'wp' rather than template_redirect.185 add_action( 'wp', 'wporg_profiles_maybe_template_redirect', 0 );186 }187 188 function wporg_profiles_maybe_template_redirect() {189 if ( is_robots() || is_feed() || is_trackback() ) {190 return;191 }192 193 ob_start();194 wp_redirect( 'https://wordpress.org/' );195 exit;196 }197 198 if ( 'profiles.wordpress.org' == $_SERVER['HTTP_HOST'] && ! is_admin() && defined( 'WP_USE_THEMES' ) && WP_USE_THEMES ) {199 add_action( 'init', 'wporg_profiles_redirect', 9 ); // before bp_init200 add_filter( 'bp_do_redirect_canonical', '__return_false' ); // Overrides #BP1741201 159 } 202 160
Note: See TracChangeset
for help on using the changeset viewer.