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.


Top ↑

Return Return

(bool)


Top ↑

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() ) {

Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0-beta.1 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.