Created
July 10, 2015 23:08
-
-
Save NikV/8fd84357e66448c02648 to your computer and use it in GitHub Desktop.
Example for: gform_post_add_subscription_payment
This file contains hidden or 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
/** | |
* Send an email after somebody renews their subscription | |
* | |
* @param array $entry The Entry Object | |
* @param array $action The Action Object | |
* $action = array( | |
* 'type' => 'cancel_subscription', // See Below | |
* 'transaction_id' => '', // What is the ID of the transaction made? | |
* 'subscription_id' => '', // What is the ID of the Subscription made? | |
* 'amount' => '0.00', // Amount to charge? | |
* 'entry_id' => 1, // What entry to check? | |
* 'transaction_type' => '', | |
* 'payment_status' => '', | |
* 'note' => '' | |
* ); | |
* | |
* 'type' can be: | |
* | |
* - complete_payment | |
* - refund_payment | |
* - fail_payment | |
* - add_pending_payment | |
* - void_authorization | |
* - create_subscription | |
* - cancel_subscription | |
* - expire_subscription | |
* - add_subscription_payment | |
* - fail_subscription_payment | |
*/ | |
function gfroms_after_add_subscription_renewed( $entry, $action ) { | |
// Lets get the form where this renewal is from | |
$form = GFAPI::get_form( $entry['form_id'] ); | |
// Lets send a form notification with the action triggered | |
GFAPI::send_notifications( $form, $entry, rgar( $action, 'type' ) ); | |
} | |
// We are using the 'gform_post_add_subscription_payment' hook here that fires right after a subscription is renewed | |
add_action( 'gform_post_add_subscription_payment', 'gfroms_after_add_subscription_renewed', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment