Remove user/site suggestions (autocompletion) from search inputs, as the UX isn't proper.

* Removes all instances of site-search, so away it goes. Sidesteps a number of bugs with site-search.
 * Renames user-search to user-suggest, which means it better describes the current behavior (autocompletion) while allowing for future behavior (instant search).
 * Ties user suggestions to a single .wp-suggest-user class.

with help from markjaquith, helenyhou, wonderboymusic. 
fixes #20835.



git-svn-id: https://develop.svn.wordpress.org/trunk@21003 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin
2012-06-05 18:51:33 +00:00
parent 26ff506998
commit 245b0655d2
14 changed files with 23 additions and 104 deletions
-24
View File
@@ -212,30 +212,6 @@ function wp_ajax_dashboard_widgets() {
wp_die();
}
function wp_ajax_autocomplete_site() {
if ( ! is_multisite() || ! current_user_can( 'manage_sites' ) || wp_is_large_network( 'sites' ) )
wp_die( -1 );
$return = array();
global $wpdb;
$like_escaped_term = '%' . like_escape( stripslashes( $_REQUEST['term'] ) ) . '%';
$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 );
if ( empty( $sites ) )
wp_die( -1 );
foreach ( (array) $sites as $details ) {
$blogname = get_blog_option( $details['blog_id'], 'blogname' );
$return[] = array(
'label' => sprintf( '%1$s (%2$s)', $blogname, $details['domain'] . $details['path'] ),
'value' => $details['domain']
);
}
wp_die( json_encode( $return ) );
}
/*
* Ajax helper.
*/
+4 -10
View File
@@ -414,12 +414,6 @@ 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 ( ! wp_is_large_network( 'users' ) )
wp_enqueue_script( 'user-search' );
if ( ! wp_is_large_network( 'sites' ) )
wp_enqueue_script( 'site-search' );
$c_users = get_user_count();
$c_blogs = get_blog_count();
@@ -442,16 +436,16 @@ function wp_network_dashboard_right_now() {
<p class="youhave"><?php echo $sentence; ?></p>
<?php do_action( 'wpmuadminresult', '' ); ?>
<form name="searchform" action="<?php echo network_admin_url('users.php'); ?>" method="get">
<form action="<?php echo network_admin_url('users.php'); ?>" method="get">
<p>
<input type="search" name="s" value="" size="30" id="all-user-search-input" />
<input type="search" name="s" value="" size="30" autocomplete="off" />
<?php submit_button( __( 'Search Users' ), 'button', 'submit', false, array( 'id' => 'submit_users' ) ); ?>
</p>
</form>
<form name="searchform" action="<?php echo network_admin_url('sites.php'); ?>" method="get">
<form action="<?php echo network_admin_url('sites.php'); ?>" method="get">
<p>
<input type="search" name="s" value="" size="30" id="site-search-input" />
<input type="search" name="s" value="" size="30" autocomplete="off" />
<?php submit_button( __( 'Search Sites' ), 'button', 'submit', false, array( 'id' => 'submit_sites' ) ); ?>
</p>
</form>