Last active
December 27, 2015 03:38
-
-
Save amdrew/7260341 to your computer and use it in GitHub Desktop.
Gets an array containing of all the payment IDs for a particular download using the get_log_ids() function
This file contains hidden or 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 | |
| /** | |
| * Get array of payment IDs | |
| * | |
| * @param int $download_id Download ID | |
| * @return array $payment_ids | |
| */ | |
| function get_payment_ids( $download_id = '' ) { | |
| // these functions are used within a class, so you may need to update the function call | |
| $log_ids = $this->get_log_ids( $download_id ); | |
| if ( $log_ids ) { | |
| // create $payment_ids array | |
| $payment_ids = array(); | |
| foreach ( $log_ids as $id ) { | |
| // get the payment ID for each corresponding log ID | |
| $payment_ids[] = get_post_meta( $id, '_edd_log_payment_id', true ); | |
| } | |
| // return our payment IDs | |
| return $payment_ids; | |
| } | |
| return null; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment