Clean up cap checks for autocompletes for sites and users in a network. see #19810.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20332 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
0507fd7a00
commit
81407efd05
|
@ -150,13 +150,11 @@ function wp_ajax_oembed_cache() {
|
|||
}
|
||||
|
||||
function wp_ajax_autocomplete_user() {
|
||||
if ( ! is_multisite()
|
||||
|| ! current_user_can( 'promote_users' )
|
||||
|| wp_is_large_network( 'users' )
|
||||
|| ( ! is_super_admin() && ! apply_filters( 'autocomplete_users_for_site_admins', false ) )
|
||||
) {
|
||||
if ( ! is_multisite() || ! current_user_can( 'promote_users' ) || wp_is_large_network( 'users' ) )
|
||||
wp_die( -1 );
|
||||
|
||||
if ( ! is_super_admin() && ! apply_filters( 'autocomplete_users_for_site_admins', false ) )
|
||||
wp_die( -1 );
|
||||
}
|
||||
|
||||
$return = array();
|
||||
|
||||
|
@ -215,13 +213,8 @@ function wp_ajax_dashboard_widgets() {
|
|||
}
|
||||
|
||||
function wp_ajax_autocomplete_site() {
|
||||
if ( ! is_multisite()
|
||||
|| ! current_user_can( 'manage_sites' )
|
||||
|| wp_is_large_network( 'sites' )
|
||||
|| ! is_super_admin()
|
||||
) {
|
||||
if ( ! is_multisite() || ! current_user_can( 'manage_sites' ) || wp_is_large_network( 'sites' ) )
|
||||
wp_die( -1 );
|
||||
}
|
||||
|
||||
$return = array();
|
||||
|
||||
|
|
|
@ -416,22 +416,11 @@ function wp_network_dashboard_right_now() {
|
|||
if ( current_user_can('create_users') )
|
||||
$actions['create-user'] = '<a href="' . network_admin_url('user-new.php') . '">' . __( 'Create a New User' ) . '</a>';
|
||||
|
||||
if ( is_multisite()
|
||||
&& current_user_can( 'promote_users' )
|
||||
&& ! wp_is_large_network( 'users' )
|
||||
&& is_super_admin()
|
||||
&& is_network_admin()
|
||||
) {
|
||||
if ( ! wp_is_large_network( 'users' ) )
|
||||
wp_enqueue_script( 'user-search' );
|
||||
}
|
||||
if ( is_multisite()
|
||||
&& current_user_can( 'manage_sites' )
|
||||
&& ! wp_is_large_network( 'sites' )
|
||||
&& is_super_admin()
|
||||
&& is_network_admin()
|
||||
) {
|
||||
|
||||
if ( ! wp_is_large_network( 'sites' ) )
|
||||
wp_enqueue_script( 'site-search' );
|
||||
}
|
||||
|
||||
$c_users = get_user_count();
|
||||
$c_blogs = get_blog_count();
|
||||
|
|
|
@ -245,13 +245,8 @@ get_current_screen()->set_help_sidebar(
|
|||
'<p>' . __('<a href="http://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>') . '</p>'
|
||||
);
|
||||
|
||||
if ( is_multisite()
|
||||
&& current_user_can( 'promote_users' )
|
||||
&& ! wp_is_large_network( 'users' )
|
||||
&& is_super_admin()
|
||||
) {
|
||||
if ( ! wp_is_large_network( 'users' ) )
|
||||
wp_enqueue_script( 'user-search' );
|
||||
}
|
||||
|
||||
require_once( '../admin-header.php' );
|
||||
|
||||
|
|
|
@ -178,9 +178,8 @@ get_current_screen()->set_help_sidebar(
|
|||
|
||||
wp_enqueue_script('wp-ajax-response');
|
||||
wp_enqueue_script('user-profile');
|
||||
if ( is_multisite()
|
||||
&& current_user_can( 'promote_users' )
|
||||
&& ! wp_is_large_network( 'users' )
|
||||
|
||||
if ( is_multisite() && current_user_can( 'promote_users' ) && ! wp_is_large_network( 'users' )
|
||||
&& ( is_super_admin() || apply_filters( 'autocomplete_users_for_site_admins', false ) )
|
||||
) {
|
||||
wp_enqueue_script( 'user-search' );
|
||||
|
|
|
@ -339,9 +339,7 @@ default:
|
|||
exit;
|
||||
}
|
||||
|
||||
if ( is_multisite()
|
||||
&& current_user_can( 'promote_users' )
|
||||
&& ! wp_is_large_network( 'users' )
|
||||
if ( is_multisite() && current_user_can( 'promote_users' ) && ! wp_is_large_network( 'users' )
|
||||
&& ( is_super_admin() || apply_filters( 'autocomplete_users_for_site_admins', false ) )
|
||||
) {
|
||||
wp_enqueue_script( 'user-search' );
|
||||
|
|
Loading…
Reference in New Issue