Created
October 18, 2011 18:12
-
-
Save curtismchale/1296194 to your computer and use it in GitHub Desktop.
supposed to catch the PayPal IPN response and publish posts
This file contains 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
add_action( 'gform_paypal_post_ipn', 'tan_deal_with_posts', 10, 8 ); | |
function tan_deal_with_posts( $ipn_post, $entry, $config, $cancel ){ | |
global $current_user; | |
$time_period = $entry['1.1']; | |
$userid = $entry['created_by']; | |
if( empty( $userid ) ) $userid = $current_user->ID; | |
if( $time_period == 'Monthly' ) { | |
$time_period = '+1 month'; | |
} | |
if( $time_period == 'Yearly' ) { | |
$time_period = '+1 year'; | |
} | |
if( $time_period == 'twoyear' ){ | |
$time_period = '+2 Year'; | |
} | |
if( $entry['payment_status'] == 'Active' ) { | |
tan_publish_bc_paid( $userid, 'publish', $time_period ); | |
tan_set_user_expire( $userid, $time_period ); | |
} | |
if( $entry['payment_status'] == 'Approved' ){ | |
tan_publish_bc_paid( $userid, 'publish', $time_period ); | |
} | |
if( $entry['payment_status'] == 'Cancelled' ) { | |
tan_publish_bc_paid( $userid, 'draft', null ); | |
} | |
// mailing me stuff for error checking | |
wp_mail( '[email protected]', 'tan_deal_with_posts', 'Entry id'.$entry['id'].'Payment Status'.$entry['payment_status'].'Time Period'.$time_period); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment