Created
December 13, 2021 15:15
-
-
Save DumahX/feeeba317708731e96f0f0ed22bc5c96 to your computer and use it in GitHub Desktop.
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 | |
function cleanup_abandoned_signups($event) { | |
$txn = $event->get_data(); | |
$user = $txn->user(); | |
// Count complete transactions and non-complete transactions | |
$user_incomplete_txns = $user->transactions('`status` != "complete"'); | |
$user_complete_txns = $user->transactions('`status` = "complete"'); | |
// User only has non-complete transactions, so delete the user. | |
if(empty($user_complete_txns) && !empty($user_incomplete_txns)) { | |
$user->destroy(); | |
} | |
} | |
add_action('mepr-event-after-signup-abandoned-reminder', 'cleanup_abandoned_signups'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment