Skip to content

Instantly share code, notes, and snippets.

View NikV's full-sized avatar
🎯
Focusing

Nikhil Vimal NikV

🎯
Focusing
View GitHub Profile
@NikV
NikV / hey-jude.php
Last active August 29, 2015 14:09 — forked from billday/hello.php
<?php
/**
* Plugin Name: Hey Jude
* Description: This would have probably happened if Matt Mullenweg was a Beatles fan. (Based off Hello Dolly)
* Version: 1.0
* Author: Nikhil Vimal
*/
function hey_jude_get_lyric() {
/** These are the lyrics to Hey Jude */
@NikV
NikV / gist:39925d1c4a37fc839bc1
Last active August 29, 2015 14:24
Gravity Forms Notification after a payment has been refunded
/**
* Fires after a payment has been refunded
*
* @param array $entry The Entry object
* @param array $action The action object
* $action = array(
* 'type' => 'cancel_subscription', // Type can be
* '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?
@NikV
NikV / gist:8fd84357e66448c02648
Created July 10, 2015 23:08
Example for: gform_post_add_subscription_payment
/**
* 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?
@NikV
NikV / gist:bb1ca7ce478c0c60d155
Created July 10, 2015 23:08
Examples for: gform_post_payment_callback
/**
* Send a notification after a user attempts a purchase
*
* @param $entry The Entries 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?
@NikV
NikV / gist:36a305e08adfa5660485
Created July 10, 2015 23:10
Example for: gform_post_fail_subscription_payment
/**
* Fires only after a subscription payment has failed
*
* @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?
@NikV
NikV / gist:2957062da2212c0a022e
Created July 10, 2015 23:10
Example for: gform_post_payment_refunded
/**
* Fires after a payment has been refunded
*
* @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?
@NikV
NikV / gist:7b7ec046df69b1f390bf
Created July 10, 2015 23:11
Example for: gform_post_payment_completed
/**
* Fires after a payment has been completed
*
* @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?
@NikV
NikV / gist:4aee2541fec3f7be9cb6
Created July 14, 2015 04:12
Example for gfrom_loaded
/**
* Fires the class when Gravity Forms has loaded
*/
add_action('gform_loaded', array('GF_Simple_Addon_bootstrap', 'load'), 5);
/**
* Class GF_Test is our Bootstrap class, it loads a lot of the important stuff, like files
*/
class GF_Simple_slack_bootstrap {
@NikV
NikV / gist:b80ee19beaef412ce0b8
Created August 20, 2015 14:24
Modify Trash Link to button, Gravity Forms
function modify_gfroms_trash_link() {
return '<button style="background: red; color: white; border: none;" class="submitdelete" title="' . __( 'Move this form to the trash', 'gravityforms' ) . '" onclick="if(confirm(\'' . __( "Would you like to move this form to the trash? \'Cancel\' to stop. \'OK\' to continue", 'gravityforms' ) . '\')){ gf_vars.isFormTrash = true; jQuery(\'#form_trash\')[0].submit();} else{return false;}">' . __( 'Trash', 'gravityforms' ) . '</button>';
}
add_filter('gform_form_trash_link', 'modify_gfroms_trash_link');
@NikV
NikV / gfroms-examples.php
Created August 22, 2015 13:36
Modify the class of the form save button in Gravity Forms
function modify_gform_save_form_button() {
return '<input type="button" class="button button-large button-primary update-form my-button-class" value="' . $button_text . '" onclick="SaveForm(' . $isNew . ');" />';;
}
add_filter('gform_save_form_button', 'modify_gform_save_form_button');