Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rafaehlers/1d147c5e6a6c42dce259df7a653f2706 to your computer and use it in GitHub Desktop.
Save rafaehlers/1d147c5e6a6c42dce259df7a653f2706 to your computer and use it in GitHub Desktop.
Send a form notification when an entry is approved/disapproved
<?php
add_action('gravityview/approve_entries/disapproved','gv_send_form_notification_approval');
add_action('gravityview/approve_entries/approved','gv_send_form_notification_approval');
function gv_send_form_notification_approval($entry_id){
$entry = GFAPI::get_entry( $entry_id );
if( ! $entry || is_wp_error( $entry ) ) {
return;
}
$form = GFAPI::get_form( $entry['form_id'] );
if( ! $form || is_wp_error( $form ) ) {
return;
}
GFCommon::send_form_submission_notifications( $form, $entry );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment