Making WordPress.org

Changeset 14022


Ignore:
Timestamp:
09/05/2024 01:38:41 AM (5 weeks ago)
Author:
dufresnesteven
Message:

support-forums: Redirect users to profiles for account changes.

File:
1 edited

Legend:

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

    r13755 r14022  
    22
    33namespace WordPressdotorg\Forums;
     4
     5use function WordPressdotorg\Two_Factor\get_edit_account_url;
    46
    57class Hooks {
     
    363365        global $wp_query, $wp;
    364366
     367        // Account information is no longer set in the support forums.
     368        // We don't use `wp_get_current_user()` because super admins often reset data for other users.
     369        if ( preg_match( '!^users/(?P<username>[^/]+)/edit/account!i', $wp->request, $matches ) ) {
     370            $url = get_edit_account_url( get_user_by( 'slug', $matches['username'] ) );
     371            wp_safe_redirect( $url, 301 );
     372            exit;
     373        };
     374
    365375        // A user called 'profile' exists, but override it.
    366376        if ( 'profile' === get_query_var( 'bbp_user' ) ) {
Note: See TracChangeset for help on using the changeset viewer.