Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
adds payment related notification events (drop down appears after notification name on the notification editor page). Requires 1.9.5.13 or greater.
add_filter( 'gform_notification_events', function ( $notification_events, $form ) {
$has_stripe_feed = function_exists( 'gf_stripe' ) ? gf_stripe()->get_feeds( $form['id'] ) : false;
$has_paypal_feed = function_exists( 'gf_paypal' ) ? gf_paypal()->get_feeds( $form['id'] ) : false;
$has_paypalpaymentspro_feed = function_exists( 'gf_paypalpaymentspro' ) ? gf_paypalpaymentspro()->get_feeds( $form['id'] ) : false;
$has_authorizenet_feed = function_exists( 'gf_authorizenet' ) ? gf_authorizenet()->get_feeds( $form['id'] ) : false;
if ( $has_stripe_feed || $has_paypal_feed || $has_paypalpaymentspro_feed || $has_authorizenet_feed ) {
$payment_events = array(
'complete_payment' => __( 'Payment Completed', 'gravityforms' ),
'refund_payment' => __( 'Payment Refunded', 'gravityforms' ),
'fail_payment' => __( 'Payment Failed', 'gravityforms' ),
'add_pending_payment' => __( 'Payment Pending', 'gravityforms' ),
'void_authorization' => __( 'Authorization Voided', 'gravityforms' ),
'create_subscription' => __( 'Subscription Created', 'gravityforms' ),
'cancel_subscription' => __( 'Subscription Canceled', 'gravityforms' ),
'expire_subscription' => __( 'Subscription Expired', 'gravityforms' ),
'add_subscription_payment' => __( 'Subscription Payment Added', 'gravityforms' ),
'fail_subscription_payment' => __( 'Subscription Payment Failed', 'gravityforms' ),
);
return array_merge( $notification_events, $payment_events );
}
return $notification_events;
}, 10, 2 );
add_action( 'gform_post_payment_callback', function ( $entry, $action, $result ) {
if ( $result ) {
$form = GFAPI::get_form( $entry['form_id'] );
GFAPI::send_notifications( $form, $entry, rgar( $action, 'type' ) );
}
}, 10, 3 );
@tareqhi

This comment has been minimized.

Copy link

commented Apr 18, 2015

Hi Richard,thanks for all of your nice code and hooks.
Basically I'm a GF user. recently I faced few problem with file upload. I wanted to upload photos with file upload fields. And at the same time I needed to show the photos preview besides of upload field. Like in a picture box with thumbnail view.
The second things I needed is file upload on list field. I have the code to make a list field column as a upload field. But when I submitted forms the files are not uploading or lost.
Can you help me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.