Skip to content

Commit

Permalink
Trigger notification on GFAPI:update_entry
Browse files Browse the repository at this point in the history
(needed for the Approve/Disapprove logic)
  • Loading branch information
Luis Godinho committed Jan 16, 2015
1 parent ab13818 commit 6d0762c
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion gravityview-enable-notifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
add_action( 'gform_after_update_entry', 'gravityview_enable_gf_notifications_after_update', 10, 2 );

/**
* Triggers Gravity Forms notifications engine when entry is updated
* Triggers Gravity Forms notifications engine when entry is updated (admin or frontend)
* @param array $form GF form
* @param int $entry_id Lead/entry id
* @return void
Expand All @@ -28,4 +28,23 @@ function gravityview_enable_gf_notifications_after_update( $form, $entry_id ) {

GFCommon::send_form_submission_notifications( $form, $entry );

}


add_action( 'gform_post_update_entry', 'gravityview_enable_gf_notifications_after_api_update_entry', 10, 2 );

/**
* Triggers Gravity Forms notifications engine when entry is updated through Gravity Forms API (GFAPI)
* @param array $entry Updated entry object
* @param array $original_entry Original entry object
* @return void
*/
function gravityview_enable_gf_notifications_after_api_update_entry( $entry, $original_entry ) {
if( !is_admin() || !class_exists('GFCommon') || !class_exists( 'GFAPI' ) ) {
return;
}

$form = GFAPI::get_form( $entry['form_id'] );

GFCommon::send_form_submission_notifications( $form, $entry );
}

0 comments on commit 6d0762c

Please sign in to comment.