gravityflow_step_notification_assignees

Description

The gravityflow_step_notification_assignees filter allows developers to customize the list of assignees who will receive notifications for a specific step.

Usage

add_filter( 'gravityflow_step_notification_assignees', 'your_callback_function', 10, 2 );

Parameters

ParameterTypeDescription
$assigneesGravity_Flow_AssigneeAn array of assignee objects who will receive the notification.
$stepGravity_Flow_StepThe current step object for which the notification is being processed.

Examples

Add a Default Assignee to Notification Steps When None Are Set.

add_filter( 'gravityflow_step_notification_assignees', 'jo_step_notification_assignees_default', 10, 2 );
function jo_step_notification_assignees_default( $assignees, $step ) {
	$test = $step->get_type();
	if ( $step->get_type() == 'notification' && empty( $assignees ) ) {
		
		//Define args to have a default user included on notifications.
		$args = array(
			'id'  => 1,
			'type' => 'user',
			'key' => 'user|1',
			'editable_fields' => array( '1000' ),
		);
		$new_assignee = new Gravity_Flow_Assignee( $args, $step );
		$assignees[] = $new_assignee;
	}
	return $assignees;
}

Placement

This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.

See also the PHP section in this article: Where Do I Put This Code?

Source Code

This filter is located in includes/steps/class-step.php

Since

This filter was added in Gravity Flow 2.9