Description
The gravityflow_network_non_site_user_notification filter allows enabling workflow notifications to be delivered to non-site users in a multi-site environment.
Parameters
Parameter | Type | Details |
---|---|---|
$to_add_user | Boolean | Indicates if a non-site user will receive notification for this step. |
$user | WP_User | The user who is the assignee for the current step. |
$notification | Notification | The notification properties. |
$assignee_id | Integer | The assignee ID – if applicable. |
$entry | Entry | The current entry. |
$step | Step | The current step. |
Examples
Perform a workflow notification for an assignee even if they are not a current site member
This example will allow the workflow notification for Assignee “7”, if assigned, to be performed even if they are not a site member.
add_filter( 'gravityflow_network_non_site_user_notification', 'sh_gravityflow_network_non_site_user_notification', 10, 6 );
function sh_gravityflow_network_non_site_user_notification( $to_add_user, $user, $notification, $assignee_id, $entry, $step ) {
if ( $assignee_id == 7 ) {
$to_add_user = true;
}
return $to_add_user;
}
For notifications related to a user with the Super Admin capability, you would use either is_super_admin() or check for current_user_can( ‘setup_network’ ) capability.
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?