Created
January 6, 2018 08:16
-
-
Save xnau/0f20a023bd4c13f7e1b9368f0ffcb562 to your computer and use it in GitHub Desktop.
Demonstrates how to "unapprove" a record in Participants Database Member Payments if the account is not paid
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 | |
/** | |
* @wordpress-plugin | |
* Plugin Name: Unapprove Unpaid Records | |
* Description: unapproves the record if the account has not been paid | |
*/ | |
add_action( 'pdbmps-status_change_to_due', 'xnau_unapprove_unpaid_account' ); | |
/** | |
* unapproves the record if the payment lapses | |
* | |
* this is fired on the "change_to_due" action because that is when the payment | |
* period expires. If the user pays before that (such as after the "payable" date), | |
* the account will not be unapproved because this action will never fire. | |
* | |
* @param array $data the user's record | |
*/ | |
function xnau_unapprove_unpaid_account( $data ) | |
{ | |
if ( isset( $data['id'] ) && $record_id = $data['id'] ) { | |
Participants_Db::write_participant(array('approved' => 'no'), $record_id ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment