Skip to content

Instantly share code, notes, and snippets.

@supercleanse
Created April 25, 2014 21:24
Show Gist options
  • Save supercleanse/11303833 to your computer and use it in GitHub Desktop.
Save supercleanse/11303833 to your computer and use it in GitHub Desktop.
Example of how to use the sub-create hooks
<?php
add_action("mepr-upgraded-recurring-sub", "upgraded_recurring_sub");
function upgraded_recurring_sub( $sub ) { ... }
add_action("mepr-upgraded-single-sub", "upgraded_single_sub");
function upgraded_single_sub( $txn ) { ... }
add_action("mepr-upgraded-sub", "upgraded_sub");
function upgraded_sub( $type, $sub ) { if( $type==='single' ) { /* sub is a txn */ } else { /* sub is a sub */ } }
add_action("mepr-downgraded-recurring-sub", "downgraded_recurring_sub");
function downgraded_recurring_sub( $sub ) { ... }
add_action("mepr-downgraded-single-sub", "downgraded_single_sub");
function downgraded_single_sub( $txn ) { ... }
add_action("mepr-downgraded-sub", "downgraded_sub");
function downgraded_sub( $type, $sub ) { if( $type==='single' ) { /* sub is a txn */ } else { /* sub is a sub */ } }
add_action("mepr-new-recurring-sub", "new_recurring_sub");
function new_recurring_sub( $sub ) { ... }
add_action("mepr-new-single-sub", "new_single_sub");
function new_single_sub( $txn ) { ... }
add_action("mepr-new-sub", "new_sub");
function new_sub( $type, $sub ) { if( $type==='single' ) { /* sub is a txn */ } else { /* sub is a sub */ } }
add_action("mepr-sub-created", "sub_created");
function sub_created( $type, $sub, $action ) { if( $type==='single' ) { /* sub is a txn */ } else { /* sub is a sub */ } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment