Making WordPress.org

Changeset 11330


Ignore:
Timestamp:
11/17/2021 06:12:18 AM (3 years ago)
Author:
dd32
Message:

Add support for https://wordpress.org/.well-known/change-password as supported by Safari, Chrome, and 1Password.

Introduces https://wordpress.org/support/users/my-profile/ to make redirects to the current users profile (and prompt for login otherwise).

Fixes #5830.

Location:
sites/trunk/wordpress.org/public_html/wp-content
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/mu-plugins/pub/wporg-well-known.php

    r11107 r11330  
    99}
    1010
    11 if (
    12     '/.well-known/security.txt' === $_SERVER['REQUEST_URI'] ||
    13     '/security.txt' === $_SERVER['REQUEST_URI']
    14 ) {
    15     security_txt();
    16     exit;
    17 }
     11add_action( 'init', function() {
     12    if (
     13        '/.well-known/security.txt' === $_SERVER['REQUEST_URI'] ||
     14        '/security.txt' === $_SERVER['REQUEST_URI']
     15    ) {
     16        security_txt();
     17        exit;
     18    }
     19
     20    if ( '/.well-known/change-password' === $_SERVER['REQUEST_URI'] ) {
     21        wp_safe_redirect( 'https://wordpress.org/support/users/my-profile/edit/' );
     22        exit;
     23    }
     24} );
    1825
    1926function security_txt() {
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-hooks.php

    r11313 r11330  
    313313     * Redirect legacy urls to their new permastructure.
    314314     *  - /users/$id & /profile/$slug to /users/$slug
     315     *  - /users/my-profile/* => /users/$slug/*
    315316     *
    316317     * See also: Support_Compat in inc/class-support-compat.php
    317318     */
    318319    public function redirect_legacy_urls() {
    319         global $wp_query;
     320        global $wp_query, $wp;
    320321
    321322        if ( ! is_404() ) {
     
    342343                exit;
    343344            }
     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 );
    344356        }
    345357    }
Note: See TracChangeset for help on using the changeset viewer.