WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
фильтр не описан

user_has_cap хук-фильтр . WP 2.0.0

Dynamically filter a user's capabilities.

Использование

add_filter( 'user_has_cap', 'filter_function_name_9598', 10, 4 );
function filter_function_name_9598( $allcaps, $caps, $args, $user ){
	// filter...

	return $allcaps;
}
$allcaps(true/false[])
Array of key/value pairs where keys represent a capability name and boolean values represent whether the user has that capability.
$caps(строка[])
Required primitive capabilities for the requested capability.
$args(массив)

Arguments that accompany the requested capability check.

  • $0 (строка)
    Requested capability.

  • $1 (число)
    Concerned user ID.

  • ...$2 (смешанный)
    Optional second and further parameters, typically object ID.
$user(WP_User)
The user object.

Заметки

  • C версии 3.7.0 Added the $user parameter.

Где вызывается хук

WP_User::has_cap()
user_has_cap
wp-includes/class-wp-user.php 768
$capabilities = apply_filters( 'user_has_cap', $this->allcaps, $caps, $args, $this );

Где используется хук (в ядре WP)

wp-includes/default-filters.php 581
add_filter( 'user_has_cap', 'wp_maybe_grant_install_languages_cap', 1 );
wp-includes/default-filters.php 582
add_filter( 'user_has_cap', 'wp_maybe_grant_resume_extensions_caps', 1 );