Skip to content

Instantly share code, notes, and snippets.

@amdrew
Last active December 27, 2015 03:38
Show Gist options
  • Select an option

  • Save amdrew/7260341 to your computer and use it in GitHub Desktop.

Select an option

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
<?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