Tribe__Tickets__Metabox::has_permission( WP_Post|int $post, array $data, string $nonce_action )
test if the nonce is correct and the current user has the correct permissions
Contents
Parameters
- $post
-
(WP_Post|int) (Required)
- $data
-
(array) (Required)
- $nonce_action
-
(string) (Required)
Return
(boolean)
Source
File: src/Tribe/Metabox.php
public function has_permission( $post, $data, $nonce_action ) {
if ( ! $post instanceof WP_Post ) {
if ( ! is_numeric( $post ) ) {
return false;
}
$post = get_post( $post );
}
if ( empty( $data['nonce'] ) || ! wp_verify_nonce( $data['nonce'], $nonce_action ) ) {
return false;
}
return current_user_can( 'edit_event_tickets' ) || current_user_can( get_post_type_object( $post->post_type )->cap->edit_posts );
}
Changelog
| Version | Description |
|---|---|
| 4.6.2 | Introduced. |