LLMS_REST_Webhook::is_valid_action( array $args )
Determine if the current action is valid for the webhook
Parameters Parameters
- $args
-
(array) (Required) Numeric array of arguments from the originating hook.
Return Return
(bool)
Source Source
File: libraries/lifterlms-rest/includes/models/class-llms-rest-webhook.php
* Determine if the current action is valid for the webhook
*
* @param bool $ret Whether or not the action is valid.
* @param array $args Numeric array of arguments from the originating hook.
* @param LLMS_REST_Webhook $this Webhook object.
*/
return apply_filters( 'llms_rest_webhook_is_valid_action', $ret, $args, $this );
}
/**
* Determine if the current post-related action is valid for the webhook
*
* @since 1.0.0-beta.1
*
* @param int $post_id WP Post ID.
* @return bool
*/
protected function is_valid_post_action( $post_id ) {
$post_type = get_post_type( $post_id );
// Check the post type is a supported post type.
if ( ! in_array( get_post_type( $post_id ), LLMS_REST_API()->webhooks()->get_post_type_resources(), true ) ) {
return false;
}
// Ensure the current action matches the resource for the current webhook.
if ( str_replace( 'llms_', '', $post_type ) !== $this->get_resource() ) {
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 1.0.0-beta.1 | Introduced. |