Edit File by line
/home/barbar84/public_h.../wp-admin/js
File: user-suggest.js
/**
[0] Fix | Delete
* Suggests users in a multisite environment.
[1] Fix | Delete
*
[2] Fix | Delete
* For input fields where the admin can select a user based on email or
[3] Fix | Delete
* username, this script shows an autocompletion menu for these inputs. Should
[4] Fix | Delete
* only be used in a multisite environment. Only users in the currently active
[5] Fix | Delete
* site are shown.
[6] Fix | Delete
*
[7] Fix | Delete
* @since 3.4.0
[8] Fix | Delete
* @output wp-admin/js/user-suggest.js
[9] Fix | Delete
*/
[10] Fix | Delete
[11] Fix | Delete
/* global ajaxurl, current_site_id, isRtl */
[12] Fix | Delete
[13] Fix | Delete
(function( $ ) {
[14] Fix | Delete
var id = ( typeof current_site_id !== 'undefined' ) ? '&site_id=' + current_site_id : '';
[15] Fix | Delete
$(document).ready( function() {
[16] Fix | Delete
var position = { offset: '0, -1' };
[17] Fix | Delete
if ( typeof isRtl !== 'undefined' && isRtl ) {
[18] Fix | Delete
position.my = 'right top';
[19] Fix | Delete
position.at = 'right bottom';
[20] Fix | Delete
}
[21] Fix | Delete
[22] Fix | Delete
/**
[23] Fix | Delete
* Adds an autocomplete function to input fields marked with the class
[24] Fix | Delete
* 'wp-suggest-user'.
[25] Fix | Delete
*
[26] Fix | Delete
* A minimum of two characters is required to trigger the suggestions. The
[27] Fix | Delete
* autocompletion menu is shown at the left bottom of the input field. On
[28] Fix | Delete
* RTL installations, it is shown at the right top. Adds the class 'open' to
[29] Fix | Delete
* the input field when the autocompletion menu is shown.
[30] Fix | Delete
*
[31] Fix | Delete
* Does a backend call to retrieve the users.
[32] Fix | Delete
*
[33] Fix | Delete
* Optional data-attributes:
[34] Fix | Delete
* - data-autocomplete-type (add, search)
[35] Fix | Delete
* The action that is going to be performed: search for existing users
[36] Fix | Delete
* or add a new one. Default: add
[37] Fix | Delete
* - data-autocomplete-field (user_login, user_email)
[38] Fix | Delete
* The field that is returned as the value for the suggestion.
[39] Fix | Delete
* Default: user_login
[40] Fix | Delete
*
[41] Fix | Delete
* @see wp-admin/includes/admin-actions.php:wp_ajax_autocomplete_user()
[42] Fix | Delete
*/
[43] Fix | Delete
$( '.wp-suggest-user' ).each( function(){
[44] Fix | Delete
var $this = $( this ),
[45] Fix | Delete
autocompleteType = ( typeof $this.data( 'autocompleteType' ) !== 'undefined' ) ? $this.data( 'autocompleteType' ) : 'add',
[46] Fix | Delete
autocompleteField = ( typeof $this.data( 'autocompleteField' ) !== 'undefined' ) ? $this.data( 'autocompleteField' ) : 'user_login';
[47] Fix | Delete
[48] Fix | Delete
$this.autocomplete({
[49] Fix | Delete
source: ajaxurl + '?action=autocomplete-user&autocomplete_type=' + autocompleteType + '&autocomplete_field=' + autocompleteField + id,
[50] Fix | Delete
delay: 500,
[51] Fix | Delete
minLength: 2,
[52] Fix | Delete
position: position,
[53] Fix | Delete
open: function() {
[54] Fix | Delete
$( this ).addClass( 'open' );
[55] Fix | Delete
},
[56] Fix | Delete
close: function() {
[57] Fix | Delete
$( this ).removeClass( 'open' );
[58] Fix | Delete
}
[59] Fix | Delete
});
[60] Fix | Delete
});
[61] Fix | Delete
});
[62] Fix | Delete
})( jQuery );
[63] Fix | Delete
[64] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function