LLMS_REST_Webhook::process_hook( mixed $args )

Processes information from the origination action hook


Description Description

Determines if the webhook should be delivered and whether or not it should be scheduled or delivered immediately.


Top ↑

Parameters Parameters

$args

(mixed) (Required) Arguments from the hook.


Top ↑

Return Return

(int|false) Timestamp of the scheduled event when the webhook is successfully scheduled. false if the webhook should not be delivered or has already been delivered in the last 5 minutes.


Top ↑

Source Source

File: libraries/lifterlms-rest/includes/models/class-llms-rest-webhook.php

		return $this->deliver( $args );

	}

	/**
	 * Perform a test ping to the delivery url
	 *
	 * @since 1.0.0-beta.1
	 *
	 * @return true|WP_Error
	 */
	public function ping() {

		$pre = apply_filters( 'llms_rest_webhook_pre_ping', false, $this->get( 'id' ) );
		if ( false !== $pre ) {
			return $pre;
		}

		$ping = wp_safe_remote_post(
			$this->get( 'delivery_url' ),
			array(
				'user-agent' => $this->get_user_agent(),
				'body'       => sprintf( 'webhook_id=%d', $this->get( 'id' ) ),
			)
		);


Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0-beta.17 Mark this hook's first argument as processed to ensure it doesn't get processed again within the current request. And don't rely anymore on the webhook's pending_delivery property to achieve the same goal.
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.