PHP 클래스 WPCOM_VIP_Support_Role, vip-mu-plugins-public

파일 보기 프로젝트 열기: Automattic/vip-mu-plugins-public 1 사용 예제들

공개 메소드들

메소드 설명
__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 ( )