Filter
uncanny-automator-pro
automator_pro_gf_schedule_post_submission_time
Filters the scheduled post submission time for Gravity Forms entries, allowing modification of the default time.
add_filter( 'automator_pro_gf_schedule_post_submission_time', $callback, 10, 3 );
Description
Filters the scheduled post submission time for Gravity Forms entries. Use this hook to adjust the delay before actions are triggered after a form submission, allowing for necessary data propagation. The default delay is 10 seconds.
Usage
add_filter( 'automator_pro_gf_schedule_post_submission_time', 'your_function_name', 10, 3 );
Parameters
-
$entry(mixed) - This parameter likely represents a timestamp or a time-related value, offset by 10, which can be modified by the filter.
-
$form(mixed) - This parameter represents the Gravity Forms entry object, which contains all the submitted data.
-
$this(mixed) - This parameter contains the Gravity Forms form object associated with the submission.
Return Value
The filtered value.
Examples
add_filter( 'automator_pro_gf_schedule_post_submission_time', 'my_automator_gf_adjust_post_submission_time', 10, 4 );
/**
* Adjusts the scheduled post submission time for Gravity Forms entries.
*
* This filter allows developers to modify the default 10-second delay
* before a Gravity Forms submission is processed by Uncanny Automator.
* For example, you might want to delay it longer if there are complex
* integrations or external services that need time to update.
*
* @param int $timestamp The default scheduled timestamp (time() + 10 seconds).
* @param array $entry The Gravity Forms entry data.
* @param array $form The Gravity Forms form data.
* @param object $automator The Uncanny Automator object instance.
*
* @return int The modified scheduled timestamp.
*/
function my_automator_gf_adjust_post_submission_time( int $timestamp, array $entry, array $form, object $automator ): int {
// Example: If a specific form ID (e.g., 15) is submitted,
// add an extra 5 seconds to the delay.
if ( isset( $form['id'] ) && $form['id'] === 15 ) {
$timestamp = time() + 15; // 10 seconds default + 5 extra seconds
}
// Example: If a specific field value in the entry indicates a need for a longer delay,
// increase the timestamp. Let's say field ID 22 needs special handling.
if ( isset( $entry[22] ) && ! empty( $entry[22] ) && 'process-immediately' !== $entry[22] ) {
$timestamp = time() + 20; // Add an extra 10 seconds for this specific condition
}
// Return the potentially modified timestamp.
return $timestamp;
}
Placement
This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.
Source Code
uncanny-automator-pro/src/integrations/gravity-forms/triggers/gf-subfield.php:140
public function schedule_gform_submit( $entry, $form ) {
$cron_enabled = apply_filters( 'automator_pro_gf_user_submits_matching_value_cron', false, $entry, $form, $this );
// Default, cron is disabled by default
if ( false === $cron_enabled ) {
// Immediately run gform_submit if cron not enabled.
$this->validate( $entry, $form );
return;
}
if ( as_has_scheduled_action( 'uoa_gf_gform_after_submission', array( $entry, $form ) ) ) {
return;
}
// Scheduling for 10 sec so that all tax/terms are stored
return as_schedule_single_action(
apply_filters( 'automator_pro_gf_schedule_post_submission_time', time() + 10, $entry, $form, $this ),
'uoa_gf_gform_after_submission',
array(
$entry,
$form,
)
);
}