WordPress.org

Make WordPress Core

Ticket #40348: 40348.patch

File 40348.patch, 2.8 KB (added by johnjamesjacoby, 3 years ago)

First pass at optionally exposing /wp-admin/user/ on single-site installations

  • src/wp-admin/admin-header.php

    diff --git src/wp-admin/admin-header.php src/wp-admin/admin-header.php
    index d5ceecc..f582ed5 100644
     
    3434
    3535if ( is_network_admin() ) {
    3636        /* translators: Network admin screen title. 1: Network name */
    37         $admin_title = sprintf( __( 'Network Admin: %s' ), esc_html( get_network()->site_name ) );
     37        $admin_title = sprintf( __( 'Network Admin: %s' ), esc_html( get_site_option( 'site_name' ) ) );
    3838} elseif ( is_user_admin() ) {
    3939        /* translators: User dashboard screen title. 1: Network name */
    40         $admin_title = sprintf( __( 'User Dashboard: %s' ), esc_html( get_network()->site_name ) );
     40        $admin_title = sprintf( __( 'User Dashboard: %s' ), esc_html( get_site_option( 'site_name' ) ) );
    4141} else {
    4242        $admin_title = get_bloginfo( 'name' );
    4343}
  • src/wp-admin/user/admin.php

    diff --git src/wp-admin/user/admin.php src/wp-admin/user/admin.php
    index 3d5063c..ec01a86 100644
     
    1111
    1212require_once( dirname(dirname(__FILE__)) . '/admin.php');
    1313
    14 if ( ! is_multisite() ) {
    15         wp_redirect( admin_url() );
    16         exit;
     14if ( is_multisite() ) {
     15        $redirect_user_admin_request = ( ( $current_blog->domain !== $current_site->domain ) || ( $current_blog->path !== $current_site->path ) );
     16        $redirect_to_url             = user_admin_url();
     17} else {
     18        $redirect_user_admin_request = true;
     19        $redirect_to_url             = admin_url( 'profile.php' );
    1720}
    1821
    19 $redirect_user_admin_request = ( ( $current_blog->domain != $current_site->domain ) || ( $current_blog->path != $current_site->path ) );
    2022/**
    21  * Filters whether to redirect the request to the User Admin in Multisite.
     23 * Filters whether to redirect the request to the User Admin.
    2224 *
    2325 * @since 3.2.0
    2426 *
     
    2628 */
    2729$redirect_user_admin_request = apply_filters( 'redirect_user_admin_request', $redirect_user_admin_request );
    2830if ( $redirect_user_admin_request ) {
    29         wp_redirect( user_admin_url() );
     31        wp_redirect( $redirect_to_url );
    3032        exit;
    3133}
    32 unset( $redirect_user_admin_request );
     34unset( $redirect_user_admin_request, $redirect_to_url );
  • src/wp-includes/admin-bar.php

    diff --git src/wp-includes/admin-bar.php src/wp-includes/admin-bar.php
    index 98a0523..2a9fdef 100644
     
    313313
    314314        if ( is_network_admin() ) {
    315315                /* translators: %s: site name */
    316                 $blogname = sprintf( __( 'Network Admin: %s' ), esc_html( get_network()->site_name ) );
     316                $blogname = sprintf( __( 'Network Admin: %s' ), esc_html( get_site_option( 'site_name' ) ) );
    317317        } elseif ( is_user_admin() ) {
    318318                /* translators: %s: site name */
    319                 $blogname = sprintf( __( 'User Dashboard: %s' ), esc_html( get_network()->site_name ) );
     319                $blogname = sprintf( __( 'User Dashboard: %s' ), esc_html( get_site_option( 'site_name' ) ) );
    320320        }
    321321
    322322        $title = wp_html_excerpt( $blogname, 40, '…' );