Properties

$enabled

$enabled : bool

Global variable if Action Scheduler is active.

Type

normal

$default_group

$default_group : string

Action Scheduler group

Type

normal

$lib_path

$lib_path : string

Path to library

Type

normal

Methods

__construct()

__construct() : mixed

Returns

mixed

is_enabled()

is_enabled() : mixed

Returns

mixed

add_notice()

add_notice() : mixed

Returns

mixed

add_setting()

add_setting(array  $settings) : array

Adds the Action Scheduler setting to Ultimate Member feature settings

Parameters

array $settings

Returns

array

verify_wc_action_scheduler()

verify_wc_action_scheduler() : bool

Verifies whether WooCommerce is installed and activated, and checks for the existence of the WooCommerce Action Scheduler file.

Returns

bool

load_library()

load_library(bool  $force = false) : bool

Tries to load Action Scheduler from Ultimate Member if file exists

Parameters

bool $force

Returns

bool

can_be_active()

can_be_active() : bool

Checks whenever Action Scheduler can be active

Returns

bool

enqueue_async_action()

enqueue_async_action(string  $hook, array  $args = array(), string  $group = '', bool  $unique = false, int  $priority = 10) : int

Enqueue an action to run one time, as soon as possible.

If Action Scheduler is disabled then do_action_ref_array is called to run action right away.

Parameters

string $hook

Required. Name of the action hook.

array $args

Arguments to pass to callbacks when the hook triggers. Default: array().

string $group

The group to assign this job to. Default: ''.

bool $unique

Whether the action should be unique. Default: false.

int $priority

Lower values take precedence over higher values. Defaults to 10, with acceptable values falling in the range 0-255.

Returns

int —

Еhe action’s ID. Zero if there was an error scheduling the action. The error will be sent to error_log

schedule_single_action()

schedule_single_action(int  $timestamp, string  $hook, array  $args = array(), string  $group = '', bool  $unique = false, int  $priority = 10) : int

Schedule an action to run one time at some defined point in the future.

Parameters

int $timestamp

Required. The Unix timestamp representing the date you want the action to run.

string $hook

Required. Name of the action hook.

array $args

Arguments to pass to callbacks when the hook triggers. Default: array()

string $group

The group to assign this job to. Default: ''.

bool $unique

Whether the action should be unique. Default: false.

int $priority

Lower values take precedence over higher values. Defaults to 10, with acceptable values falling in the range 0-255.

Returns

int —

The action’s ID. Zero if there was an error scheduling the action. The error will be sent to error_log.

schedule_recurring_action()

schedule_recurring_action(int  $timestamp, int  $interval_in_seconds, string  $hook, array  $args = array(), string  $group = '', bool  $unique = false, int  $priority = 10) : int

Schedule an action to run repeatedly with a specified interval in seconds.

Parameters

int $timestamp

Required. The Unix timestamp representing the date you want the action to run.

int $interval_in_seconds

Required. How long to wait between runs.

string $hook

Required. Name of the action hook.

array $args

Arguments to pass to callbacks when the hook triggers. Default: array().

string $group

The group to assign this job to. Default: ''.

bool $unique

Whether the action should be unique. Default: false.

int $priority

Lower values take precedence over higher values. Defaults to 10, with acceptable values falling in the range 0-255.

Returns

int —

The action’s ID. Zero if there was an error scheduling the action. The error will be sent to error_log.

schedule_cron_action()

schedule_cron_action(int  $timestamp, string  $schedule, string  $hook, array  $args = array(), string  $group = '', bool  $unique = false, int  $priority = 10) : int

Schedule an action that recurs on a cron-like schedule.

If execution of a cron-like action is delayed, the next attempt will still be scheduled according to the provided cron expression.

Parameters

int $timestamp

Required. The Unix timestamp representing the date you want the action to run.

string $schedule

Required. A cron-like schedule string, see http://en.wikipedia.org/wiki/Cron.

string $hook

Required Name of the action hook.

array $args

Arguments to pass to callbacks when the hook triggers. Default: array().

string $group

The group to assign this job to. Default: ''.

bool $unique

Whether the action should be unique. Default: false.

int $priority

Lower values take precedence over higher values. Defaults to 10, with acceptable values falling in the range 0-255.

Returns

int —

The action’s ID. Zero if there was an error scheduling the action. The error will be sent to error_log.

unschedule_action()

unschedule_action(string  $hook, array  $args = array(), string  $group = '') : int|null

Cancel the next occurrence of a scheduled action.

Parameters

string $hook

Required. Name of the action hook.

array $args

Arguments passed to callbacks when the hook triggers. Default: array().

string $group

The group the job is assigned to. Default: ''.

Returns

int|null —

The scheduled action ID if a scheduled action was found, or null if no matching action found.

unschedule_all_actions()

unschedule_all_actions(string  $hook, array  $args = array(), string  $group = '') : mixed

Cancel all occurrences of a scheduled action.

Parameters

string $hook

The hook that the job will trigger.

array $args

Args that would have been passed to the job.

string $group

The group the job is assigned to.

Returns

mixed

next_scheduled_action()

next_scheduled_action(string  $hook, array  $args = array(), string  $group = '') : int|bool

Returns the next timestamp for a scheduled action.

Parameters

string $hook

Required. Name of the action hook. Default: none.

array $args

Arguments passed to callbacks when the hook triggers. Default: array().

string $group

The group the job is assigned to. Default: ''.

Returns

int|bool —

The timestamp for the next occurrence of a pending scheduled action, true for an async or in-progress action or false if there is no matching action.

has_scheduled_action()

has_scheduled_action(string  $hook, array  $args = array(), string  $group = '') : bool

Check if there is a scheduled action in the queue, but more efficiently than as_next_scheduled_action().

It’s recommended to use this function when you need to know whether a specific action is currently scheduled.

Parameters

string $hook

Required. Name of the action hook. Default: none.

array $args

Arguments passed to callbacks when the hook triggers. Default: array().

string $group

The group the job is assigned to. Default: ''.

Returns

bool —

True if a matching action is pending or in-progress, false otherwise.

get_scheduled_actions()

get_scheduled_actions(array  $args, string  $return_format = 'OBJECT') : array

Parameters

array $args

Arguments to search and filter results by. Possible arguments, with their default values: 'hook' => '' - the name of the action that will be triggered 'args' => NULL - the args array that will be passed with the action 'date' => NULL - the scheduled date of the action. Expects a DateTime object, a unix timestamp, or a string that can parsed with strtotime(). 'date_compare' => '<=' - operator for testing “date”. accepted values are ‘!=’, ‘>’, ‘>=’, ‘<’, ‘<=’, ‘=’ 'modified' => NULL - the date the action was last updated. Expects a DateTime object, a unix timestamp, or a string that can parsed with strtotime(). 'modified_compare' => '<=' - operator for testing “modified”. accepted values are ‘!=’, ‘>’, ‘>=’, ‘<’, ‘<=’, ‘=’ 'group' => '' - the group the action belongs to 'status' => '' - ActionScheduler_Store::STATUS_COMPLETE or ActionScheduler_Store::STATUS_PENDING 'claimed' => NULL - TRUE to find claimed actions, FALSE to find unclaimed actions, a string to find a specific claim ID 'per_page' => 5 - Number of results to return 'offset' => 0 'orderby' => 'date' - accepted values are ‘hook’, ‘group’, ‘modified’, or ‘date’ 'order' => 'ASC'

string $return_format

The format in which to return the scheduled actions: 'OBJECT', 'ARRAY_A', or 'ids'. Default: 'OBJECT'.

Returns

array —

Array of action rows matching the criteria specified with $args.

set_group()

set_group(mixed  $group) : mixed

Parameters

mixed $group

Returns

mixed