Making WordPress.org

Changeset 8225


Ignore:
Timestamp:
02/12/2019 01:57:24 AM (8 years ago)
Author:
dd32
Message:

Support Forums: Don't 404 user pages, add a canonical link to profiles.wordpress.org.

Fixes #4170.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-hooks.php

    r8215 r8225  
    8383                // Remove the redundant prefixes in the bbPress <title>.
    8484                add_filter( 'bbp_raw_title_array', array( $this, 'bbp_raw_title_array' ) );
     85
     86                // Don't 404 user profile pages. Fixed in bbPress 2.6: https://bbpress.trac.wordpress.org/ticket/3047
     87                add_filter( 'bbp_template_redirect', array( $this, 'disable_404_for_user_profile' ) );
     88
    8589        }
    8690
     
    289293                        remove_action( 'wp_head', 'rel_canonical' ); // Doesn't handle pagination.
    290294                        $canonical_url = bbp_get_forum_permalink();
     295                } elseif ( bbpress()->displayed_user && bbpress()->displayed_user->exists() ) {
     296                        // This covers all user pages rather than using 6 different bbp_is_*() calls.
     297                        $canonical_url = 'https://profiles.wordpress.org/' . bbpress()->displayed_user->user_nicename . '/';
    291298                }
    292299
     
    755762                return $title;
    756763        }
     764
     765        /**
     766         * Don't 404 for user profile pages. Fixed in bbPress 2.6: https://bbpress.trac.wordpress.org/ticket/3047
     767         */
     768        function disable_404_for_user_profile() {
     769                if ( bbpress()->displayed_user && bbpress()->displayed_user->exists() ) {
     770                        status_header( 200 );
     771                }
     772        }
    757773}
Note: See TracChangeset for help on using the changeset viewer.