Skip to content

Instantly share code, notes, and snippets.

@mgratch
Created May 12, 2015 01:46
Show Gist options
  • Save mgratch/d39c06c827a6aa1ff3d9 to your computer and use it in GitHub Desktop.
Save mgratch/d39c06c827a6aa1ff3d9 to your computer and use it in GitHub Desktop.
this will add the approval event to gravityforms notifications and then send that approval notification upon approval via GravityView.
add_filter( 'gform_notification_events', 'gw_add_manual_notification_event' );
function gw_add_manual_notification_event( $events ) {
$events['su_approval'] = __( 'Send Approval' );
return $events;
}
add_action('gravityview/approve_entries/approved','su_send_approval');
function su_send_approval($entry_id){
$entry = RGFormsModel::get_lead($entry_id);
$event = 'su_approval';
$form_id = $entry['form_id'];
$form = GFAPI::get_form( $form_id );
$notification = GFCommon::get_notifications_to_send( $event, $form, $entry );
$notifications_to_send[] = $notification[0]['id'];
GFCommon::send_notifications( $notifications_to_send, $form, $entry, true, $event );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment