Created
May 12, 2015 01:46
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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