wphooks.info - autocomplete_users_for_site_admins

autocomplete_users_for_site_admins

(trunk - 5.0-alpha-43320)

The hook occurs in the following 2 files

wp-admin/includes/ajax-actions.php:
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
 * Ajax handler for user autocomplete.
 *
 * @since 3.4.0
 */
function wp_ajax_autocomplete_user() {
	if ( ! is_multisite() || ! current_user_can( 'promote_users' ) || wp_is_large_network( 'users' ) ) {
		wp_die( -1 );
	}

	/** This filter is documented in wp-admin/user-new.php */
	if ( ! current_user_can( 'manage_network_users' ) && ! apply_filters( 'autocomplete_users_for_site_admins', false ) ) {
		wp_die( -1 );
	}

	$return = array();

	// Check the type of request
	// Current allowed values are `add` and `search`
	if ( isset( $_REQUEST['autocomplete_type'] ) && 'search' === $_REQUEST['autocomplete_type'] ) {
		$type = $_REQUEST['autocomplete_type'];
wp-admin/user-new.php:
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
wp_enqueue_script( 'user-profile' );

/**
 * Filters whether to enable user auto-complete for non-super admins in Multisite.
 *
 * @since 3.4.0
 *
 * @param bool $enable Whether to enable auto-complete for non-super admins. Default false.
 */
if ( is_multisite() && current_user_can( 'promote_users' ) && ! wp_is_large_network( 'users' )
	&& ( current_user_can( 'manage_network_users' ) || apply_filters( 'autocomplete_users_for_site_admins', false ) )
) {
	wp_enqueue_script( 'user-suggest' );
}

require_once( ABSPATH . 'wp-admin/admin-header.php' );

if ( isset( $_GET['update'] ) ) {
	$messages = array();
	if ( is_multisite() ) {