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
<?php | |
// 1) User purchases and payment is complete | |
function capture_completed_transaction($txn) { | |
//It's possible this could be a recurring transaction for a product the user is already subscribed to so probably use a user meta field described below | |
$user = new MeprUser($txn->user_id); //A MeprUser object | |
$membership = new MeprProduct($txn->product_id); //A MeprProduct object | |
$users_memberships = $user->active_product_subscriptions('ids'); //An array of membership CPT ID's | |
//Here you may want to grab a user meta field of your own creating and check to see if the user is already subscribed to this membership or not | |
//If not, then push them to your 3rd party application and update the user meta field |