gravityflow_assignee_email_reminder_repeat_days

Description

The gravityflow_assignee_email_reminder_repeat_days filter is used to customize how often the assignee email reminder is sent.

Parameters

ParameterTypeDetails
$repeat_daysIntegerThe number of days between each reminder.
$formFormThe current form.
$entryEntryThe details
$stepGravity_Flow_StepThe current step.
$assigneeGravity_Flow_AssigneeThe current assignee.

Examples

Change the frequency based on the assignee role.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
add_filter( 'gravityflow_assignee_email_reminder_repeat_days', 'sh_email_reminder_repeat', 10, 5 );
function sh_email_reminder_repeat( $repeat_days, $form, $entry, $current_step, $assignee ) {
 
    //Adjust for your specific step or other conditions
    if ( $current_step->get_id !== 37 ) {
        return $repeat_days;
    }
 
    $admin = false;
 
    //Identify whether the current assignee has the adminsitrator role
    switch ( $assignee->get_type() ) {
        case 'user_id':
            $user = get_userdata( $assignee->get_id() );
            if ( in_array( 'administrator', $user->roles ) ) {
                $admin = true;
            }
            break;
        case 'role':
            if ( $assignee->get_id() == 'administrator' ) {
                $admin = true;
            }
            break;
    }
 
    //Adjust the repeat cycle if the user is an administrator
    if ( $admin == true ) {
        $repeat_days = 15;
    }
 
    return $repeat_days;
}

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?