From d784b5552cf023d9b68ad2a6104f489174f1caf7 Mon Sep 17 00:00:00 2001 From: Felix Arntz Date: Mon, 12 Dec 2016 22:41:39 +0000 Subject: [PATCH] Multisite: Replace `is_super_admin()` with `manage_network` in `get_dashboard_url()`. Unit tests for `get_dashboard_url()` have been added. Props iaaxpage. Fixes #39065. See #37616. Built from https://develop.svn.wordpress.org/trunk@39589 git-svn-id: http://core.svn.wordpress.org/trunk@39529 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/link-template.php | 4 ++-- wp-includes/version.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index 009ed06cee..7b2d3a59fc 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -3472,13 +3472,13 @@ function get_dashboard_url( $user_id = 0, $path = '', $scheme = 'admin' ) { $user_id = $user_id ? (int) $user_id : get_current_user_id(); $blogs = get_blogs_of_user( $user_id ); - if ( ! is_super_admin() && empty($blogs) ) { + if ( is_multisite() && ! user_can( $user_id, 'manage_network' ) && empty($blogs) ) { $url = user_admin_url( $path, $scheme ); } elseif ( ! is_multisite() ) { $url = admin_url( $path, $scheme ); } else { $current_blog = get_current_blog_id(); - if ( $current_blog && ( is_super_admin( $user_id ) || in_array( $current_blog, array_keys( $blogs ) ) ) ) { + if ( $current_blog && ( user_can( $user_id, 'manage_network' ) || in_array( $current_blog, array_keys( $blogs ) ) ) ) { $url = admin_url( $path, $scheme ); } else { $active = get_active_blog_for_user( $user_id ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 8aee5002f9..7d41181e2e 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.8-alpha-39588'; +$wp_version = '4.8-alpha-39589'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.