Ticket #19810: 19810.9.patch
File 19810.9.patch, 7.4 KB (added by , 13 years ago) |
---|
-
wp-includes/user.php
378 378 'include' => array(), 379 379 'exclude' => array(), 380 380 'search' => '', 381 'search_columns' => array(), 381 382 'orderby' => 'login', 382 383 'order' => 'ASC', 383 384 'offset' => '', … … 476 477 if ( $wild ) 477 478 $search = trim($search, '*'); 478 479 479 if ( false !== strpos( $search, '@') ) 480 $search_columns = array('user_email'); 481 elseif ( is_numeric($search) ) 482 $search_columns = array('user_login', 'ID'); 483 elseif ( preg_match('|^https?://|', $search) ) 484 $search_columns = array('user_url'); 485 else 486 $search_columns = array('user_login', 'user_nicename'); 480 $search_columns = array(); 481 if ( $qv['search_columns'] ) 482 $search_columns = array_intersect( $qv['search_columns'], array( 'ID', 'user_login', 'user_email', 'user_url', 'user_nicename' ) ); 483 if ( ! $search_columns ) { 484 if ( false !== strpos( $search, '@') ) 485 $search_columns = array('user_email'); 486 elseif ( is_numeric($search) ) 487 $search_columns = array('user_login', 'ID'); 488 elseif ( preg_match('|^https?://|', $search) ) 489 $search_columns = array('user_url'); 490 else 491 $search_columns = array('user_login', 'user_nicename'); 492 } 487 493 488 494 $this->query_where .= $this->get_search_sql( $search, $search_columns, $wild ); 489 495 } -
wp-includes/script-loader.php
260 260 261 261 $scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array( 'jquery', 'password-strength-meter' ), false, 1 ); 262 262 263 $scripts->add( 'user-search', "/wp-admin/js/user-search$suffix.js", array( 'jquery-ui-autocomplete' ), false, 1 ); 264 263 265 $scripts->add( 'admin-bar', "/wp-includes/js/admin-bar$suffix.js", array(), false, 1 ); 264 266 265 267 $scripts->add( 'wplink', "/wp-includes/js/wplink$suffix.js", array( 'jquery', 'wpdialogs' ), false, 1 ); -
wp-admin/admin-ajax.php
34 34 35 35 do_action( 'admin_init' ); 36 36 37 $core_actions_get = array( 'fetch-list', 'ajax-tag-search', 'wp-compression-test', 'imgedit-preview', 'oembed_cache' );37 $core_actions_get = array( 'fetch-list', 'ajax-tag-search', 'wp-compression-test', 'imgedit-preview', 'oembed_cache', 'autocomplete-user' ); 38 38 39 39 $core_actions_post = array( 40 40 'oembed_cache', 'image-editor', 'delete-comment', 'delete-tag', 'delete-link', -
wp-admin/includes/ajax-actions.php
149 149 wp_die( $return ); 150 150 } 151 151 152 function wp_ajax_autocomplete_user() { 153 if ( !is_multisite() || !current_user_can( 'promote_users' ) || wp_is_large_network() || !is_super_admin() && apply_filters( 'autocomplete_users_for_site_admins', false ) ) 154 wp_die( -1 ); 155 156 $return = array(); 157 158 // Exclude current users of this blog 159 if ( is_network_admin() ) { 160 global $id; 161 $this_blog_users = get_users( array( 'blog_id' => $id, 'fields' => 'ID' ) ); 162 } else { 163 $this_blog_users = get_users( array( 'blog_id' => get_current_blog_id(), 'fields' => 'ID' ) ); 164 } 165 166 $users = get_users( array( 167 'blog_id' => false, 168 'search' => '*' . $_REQUEST['term'] . '*', 169 'exclude' => $this_blog_users, 170 'search_columns' => array( 'user_login', 'user_nicename', 'user_email' ), 171 ) ); 172 173 foreach ( $users as $user ) { 174 $return[] = array( 175 /* translators: 1: user_login, 2: user_email */ 176 'label' => sprintf( __( '%1$s (%2$s)' ), $user->user_login, $user->user_email ), 177 'value' => $user->user_login, 178 ); 179 } 180 181 wp_die( json_encode( $return ) ); 182 } 183 152 184 /* 153 185 * Ajax helper. 154 186 */ -
wp-admin/js/user-search.dev.js
1 (function($){ 2 3 $(document).ready(function() { 4 5 var ainput = $('#adduser-email, #newuser'); 6 7 var options = { 8 source: ajaxurl + '?action=autocomplete-user', 9 appendTo: 'form#adduser', 10 select: function( event, ui ){ $(ainput).val( ui.item.value ); }, 11 delay: 500, // milliseconds 12 minLength: 2, // Don't want to match a crazy number of items. 13 }; 14 15 a = $(ainput).autocomplete(options); 16 }); 17 18 })(jQuery); 19 No newline at end of file -
wp-admin/user-new.php
178 178 179 179 wp_enqueue_script('wp-ajax-response'); 180 180 wp_enqueue_script('user-profile'); 181 if ( is_multisite() && current_user_can( 'promote_users' ) && !wp_is_large_network() && is_super_admin() || apply_filters( 'autocomplete_users_for_site_admins', false ) ) 182 wp_enqueue_script( 'user-search' ); 181 183 182 require_once ('admin-header.php');184 require_once( 'admin-header.php' ); 183 185 184 186 if ( isset($_GET['update']) ) { 185 187 $messages = array(); -
wp-admin/network/site-users.php
171 171 $parent_file = 'sites.php'; 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() ) 175 wp_enqueue_script( 'user-search' ); 176 174 177 require('../admin-header.php'); ?> 175 178 176 179 <div class="wrap"> -
wp-admin/css/wp-admin.dev.css
892 892 margin: 0; 893 893 } 894 894 895 #wpcontent input[type="text"].ui-autocomplete-loading { 896 background: transparent url('../images/loading.gif') no-repeat right center; 897 visibility: visible; 898 } 895 899 900 ul#add-to-blog-users { 901 margin: 0 0 0 14px; 902 } 903 904 form#adduser ul.ui-autocomplete { 905 padding: 0; 906 margin: 0; 907 list-style: none; 908 position: absolute; 909 z-index: 10000; 910 border-width: 1px; 911 border-style: solid; 912 913 background-color: #ffffff; 914 border-color: gray; 915 } 916 917 form#adduser .ui-widget-content { 918 background: #ececec; 919 } 920 921 form#adduser .ui-widget-content li { 922 padding: 2px 5px; 923 white-space: nowrap; 924 text-align: left; 925 color: #101010; 926 } 927 928 form#adduser .ui-widget-content li a { 929 display: block; 930 height: 100%; 931 padding: 2px 5px; 932 color: #333; 933 } 934 935 form#adduser .ui-widget-content li a.ui-state-hover { 936 background-color: #f0f0b8; 937 } 938 939 form#adduser a.remove { 940 margin: 6px 0pt 0pt -12px; 941 cursor: pointer; 942 width: 10px; 943 height: 10px; 944 display: block; 945 float: left; 946 text-indent: -9999px; 947 overflow: hidden; 948 position: absolute; 949 background: transparent url(../images/xit.gif) no-repeat; 950 } 951 952 form#adduser a.remove:hover { 953 background: transparent url(../images/xit.gif) no-repeat -10px 0; 954 } 955 956 896 957 /*------------------------------------------------------------------------------ 897 958 3.0 - Actions 898 959 ------------------------------------------------------------------------------*/