PHP Класс WPCOM_VIP_Support_Role, vip-mu-plugins-public

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( ) Class constructor. Handles hooking actions and filters, and sets some properties.
action_admin_init ( ) Hooks the admin_init action to run an update method.
action_init ( ) Hooks the init action to add the role, covering the cases where we should be using wpcom_vip_add_role.
filter_editable_roles ( array $roles ) : array Hooks the editable_roles filter to place the VIP Support at the bottom of any roles listing.
filter_user_has_cap ( array $user_caps, array $caps, array $args, WP_User $user ) : array Hooks the user_has_cap filter to allow VIP Support role users to do EVERYTHING
init ( ) : WPCOM_VIP_Support_Role Initiate an instance of this class if one doesn't exist already. Return the VipSupportRole instance.

Защищенные методы

Метод Описание
add_role ( )
error_log ( string $message ) Log errors if WP_DEBUG is defined and true.
update ( ) Checks the version option value against the version property value, and runs update routines as appropriate.

Описание методов

__construct() публичный Метод

Class constructor. Handles hooking actions and filters, and sets some properties.
public __construct ( )

action_admin_init() публичный Метод

Hooks the admin_init action to run an update method.
public action_admin_init ( )

action_init() публичный Метод

Hooks the init action to add the role, covering the cases where we should be using wpcom_vip_add_role.
public action_init ( )

add_role() защищенный статический Метод

protected static add_role ( )

error_log() защищенный статический Метод

Log errors if WP_DEBUG is defined and true.
protected static error_log ( string $message )
$message string The message to log

filter_editable_roles() публичный Метод

Hooks the editable_roles filter to place the VIP Support at the bottom of any roles listing.
public filter_editable_roles ( array $roles ) : array
$roles array An array of WP role data
Результат array An array of WP role data

filter_user_has_cap() публичный Метод

Rather than explicitly adding all the capabilities to the admin role, and possibly missing some custom ones, or copying a role, and possibly being tripped up when that role doesn't exist, we filter all user capability checks and wave past our VIP Support users as automattically having the capability being checked.
public filter_user_has_cap ( array $user_caps, array $caps, array $args, WP_User $user ) : array
$user_caps array An array of all the user's capabilities.
$caps array Actual capabilities for meta capability.
$args array Optional parameters passed to has_cap(), typically object ID.
$user WP_User The user object.
Результат array An array of all the user's caps, with the required cap added

init() публичный статический Метод

Initiate an instance of this class if one doesn't exist already. Return the VipSupportRole instance.
public static init ( ) : WPCOM_VIP_Support_Role
Результат WPCOM_VIP_Support_Role object The instance of WPCOM_VIP_Support_Role

update() защищенный Метод

Checks the version option value against the version property value, and runs update routines as appropriate.
protected update ( )