Changeset 20279
- Timestamp:
- 03/24/2012 04:54:58 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-ajax.php
r20190 r20279 37 37 $core_actions_get = array( 38 38 'fetch-list', 'ajax-tag-search', 'wp-compression-test', 'imgedit-preview', 'oembed-cache', 39 'autocomplete-user', ' dashboard-widgets',39 'autocomplete-user', 'autocomplete-site', 'dashboard-widgets', 40 40 ); 41 41 -
trunk/wp-admin/css/wp-admin.dev.css
r20272 r20279 901 901 .ui-autocomplete li a.ui-state-hover { 902 902 background-color: #f0f0b8; 903 cursor: pointer; 903 904 } 904 905 -
trunk/wp-admin/includes/ajax-actions.php
r20190 r20279 161 161 $return = array(); 162 162 163 // Check the type of request 164 if ( isset( $_REQUEST['autocomplete_type'] ) ) 165 $type = $_REQUEST['autocomplete_type']; 166 else 167 $type = 'add'; 168 163 169 // Exclude current users of this blog 164 170 if ( isset( $_REQUEST['site_id'] ) ) … … 167 173 $id = get_current_blog_id(); 168 174 169 $this_blog_users = get_users( array( 'blog_id' => $id, 'fields' => 'ID' ) ); 175 $include_blog_users = ( $type == 'search' ? get_users( array( 'blog_id' => $id, 'fields' => 'ID' ) ) : array() ); 176 $exclude_blog_users = ( $type == 'add' ? get_users( array( 'blog_id' => $id, 'fields' => 'ID' ) ) : array() ); 170 177 171 178 $users = get_users( array( 172 179 'blog_id' => false, 173 180 'search' => '*' . $_REQUEST['term'] . '*', 174 'exclude' => $this_blog_users, 181 'include' => $include_blog_users, 182 'exclude' => $exclude_blog_users, 175 183 'search_columns' => array( 'user_login', 'user_nicename', 'user_email' ), 176 184 ) ); … … 205 213 } 206 214 wp_die(); 215 } 216 217 function wp_ajax_autocomplete_site() { 218 if ( ! is_multisite() 219 || ! current_user_can( 'manage_sites' ) 220 || wp_is_large_network( 'sites' ) 221 || ! is_super_admin() 222 ) { 223 wp_die( -1 ); 224 } 225 226 $return = array(); 227 228 global $wpdb; 229 $like_escaped_term = '%' . like_escape( stripslashes( $_REQUEST['term'] ) ) . '%'; 230 $sites = $wpdb->get_results( $wpdb->prepare( "SELECT blog_id, domain, path FROM $wpdb->blogs WHERE ( domain LIKE %s OR path LIKE %s ) AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' ORDER BY registered DESC", $like_escaped_term, $like_escaped_term ), ARRAY_A ); 231 232 if ( empty( $sites ) ) 233 wp_die( -1 ); 234 235 foreach ( (array) $sites as $details ) { 236 $blogname = get_blog_option( $details['blog_id'], 'blogname' ); 237 $return[] = array( 238 'label' => sprintf( '%1$s (%2$s)', $blogname, $details['domain'] . $details['path'] ), 239 'value' => $details['domain'] 240 ); 241 } 242 243 wp_die( json_encode( $return ) ); 207 244 } 208 245 -
trunk/wp-admin/includes/dashboard.php
r20272 r20279 417 417 $actions['create-user'] = '<a href="' . network_admin_url('user-new.php') . '">' . __( 'Create a New User' ) . '</a>'; 418 418 419 if ( is_multisite() 420 && current_user_can( 'promote_users' ) 421 && ! wp_is_large_network( 'users' ) 422 && is_super_admin() 423 && is_network_admin() 424 ) { 425 wp_enqueue_script( 'user-search' ); 426 } 427 if ( is_multisite() 428 && current_user_can( 'manage_sites' ) 429 && ! wp_is_large_network( 'sites' ) 430 && is_super_admin() 431 && is_network_admin() 432 ) { 433 wp_enqueue_script( 'site-search' ); 434 } 435 419 436 $c_users = get_user_count(); 420 437 $c_blogs = get_blog_count(); … … 441 458 <form name="searchform" action="<?php echo network_admin_url('users.php'); ?>" method="get"> 442 459 <p> 443 <input type="search" name="s" value="" size="17" />460 <input type="search" name="s" value="" size="17" id="all-user-search-input" /> 444 461 <?php submit_button( __( 'Search Users' ), 'button', 'submit', false, array( 'id' => 'submit_users' ) ); ?> 445 462 </p> … … 448 465 <form name="searchform" action="<?php echo network_admin_url('sites.php'); ?>" method="get"> 449 466 <p> 450 <input type="search" name="s" value="" size="17" />467 <input type="search" name="s" value="" size="17" id="site-search-input" /> 451 468 <?php submit_button( __( 'Search Sites' ), 'button', 'submit', false, array( 'id' => 'submit_sites' ) ); ?> 452 469 </p> -
trunk/wp-admin/index.php
r19920 r20279 89 89 '<p>' . __( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>' 90 90 ); 91 91 92 92 include (ABSPATH . 'wp-admin/admin-header.php'); 93 93 -
trunk/wp-admin/js/user-search.dev.js
r19903 r20279 3 3 4 4 $( '#adduser-email, #newuser' ).autocomplete({ 5 source: ajaxurl + '?action=autocomplete-user' + id, 5 source: ajaxurl + '?action=autocomplete-user&autocomplete_type=add' + id, 6 delay: 500, 7 minLength: 2 8 }); 9 10 $( '#user-search-input' ).autocomplete({ 11 source: ajaxurl + '?action=autocomplete-user&autocomplete_type=search' + id, 12 delay: 500, 13 minLength: 2 14 }); 15 16 $( '#all-user-search-input' ).autocomplete({ 17 source: ajaxurl + '?action=autocomplete-user&autocomplete_type=search-all' + id, 6 18 delay: 500, 7 19 minLength: 2 -
trunk/wp-admin/js/user-search.js
r19904 r20279 1 jQuery(function( a){var b=typeof(current_site_id)!="undefined"?"&site_id="+current_site_id:"";a("#adduser-email, #newuser").autocomplete({source:ajaxurl+"?action=autocomplete-user"+b,delay:500,minLength:2})});1 jQuery(function($){var id=typeof(current_site_id)!="undefined"?"&site_id="+current_site_id:"";$("#adduser-email, #newuser").autocomplete({source:ajaxurl+"?action=autocomplete-user&autocomplete_type=add"+id,delay:500,minLength:2});$("#user-search-input").autocomplete({source:ajaxurl+"?action=autocomplete-user&autocomplete_type=search"+id,delay:500,minLength:2});$("#all-user-search-input").autocomplete({source:ajaxurl+"?action=autocomplete-user&autocomplete_type=search-all"+id,delay:500,minLength:2})}); -
trunk/wp-admin/network/site-users.php
r20196 r20279 172 172 $submenu_file = 'sites.php'; 173 173 174 if ( current_user_can( 'promote_users' ) && apply_filters( 'show_network_site_users_add_existing_form', true ) && !wp_is_large_network( 'users') )174 if ( ! wp_is_large_network( 'users' ) && apply_filters( 'show_network_site_users_add_existing_form', true ) ) 175 175 wp_enqueue_script( 'user-search' ); 176 176 -
trunk/wp-admin/network/sites.php
r20092 r20279 283 283 $wp_list_table->prepare_items(); 284 284 285 if ( ! wp_is_large_network( 'sites' ) ) 286 wp_enqueue_script( 'site-search' ); 287 285 288 require_once( '../admin-header.php' ); 286 289 ?> -
trunk/wp-admin/network/users.php
r20093 r20279 246 246 ); 247 247 248 if ( is_multisite() 249 && current_user_can( 'promote_users' ) 250 && ! wp_is_large_network( 'users' ) 251 && is_super_admin() 252 ) { 253 wp_enqueue_script( 'user-search' ); 254 } 255 248 256 require_once( '../admin-header.php' ); 249 257 … … 289 297 290 298 <form action="" method="get" class="search-form"> 291 <?php $wp_list_table->search_box( __( 'Search Users' ), ' user' ); ?>299 <?php $wp_list_table->search_box( __( 'Search Users' ), 'all-user' ); ?> 292 300 </form> 293 301 -
trunk/wp-admin/users.php
r19640 r20279 339 339 exit; 340 340 } 341 342 if ( is_multisite() 343 && current_user_can( 'promote_users' ) 344 && ! wp_is_large_network( 'users' ) 345 && ( is_super_admin() || apply_filters( 'autocomplete_users_for_site_admins', false ) ) 346 ) { 347 wp_enqueue_script( 'user-search' ); 348 } 349 341 350 include('./admin-header.php'); 342 351 -
trunk/wp-includes/script-loader.php
r20179 r20279 269 269 $scripts->add( 'user-search', "/wp-admin/js/user-search$suffix.js", array( 'jquery-ui-autocomplete' ), false, 1 ); 270 270 271 $scripts->add( 'site-search', "/wp-admin/js/site-search$suffix.js", array( 'jquery-ui-autocomplete' ), false, 1 ); 272 271 273 $scripts->add( 'admin-bar', "/wp-includes/js/admin-bar$suffix.js", array(), false, 1 ); 272 274
Note: See TracChangeset
for help on using the changeset viewer.