Description
The gravityflow_assignee_email_reminder_repeat_days filter is used to customize how often the assignee email reminder is sent.
Parameters
Parameter | Type | Details |
---|---|---|
$repeat_days | Integer | The number of days between each reminder. |
$form | Form | The current form. |
$entry | Entry | The details |
$step | Gravity_Flow_Step | The current step. |
$assignee | Gravity_Flow_Assignee | The current assignee. |
Examples
Change the frequency based on the assignee role.
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?