Skip to content

Instantly share code, notes, and snippets.

@KingYes
Created Mar 25, 2015
Embed
What would you like to do?
Fixes EDD Software Licenses - Past payments after EDD Upgrade to v2.3
<?php
global $wpdb;
$license_ids = $wpdb->get_col(
"SELECT `post_id` FROM {$wpdb->postmeta}
WHERE `meta_key` LIKE '_edd_sl_user_id'
AND `meta_value` = '0';"
);
if ( ! empty( $license_ids ) ) {
$payment_ids = array();
foreach ( $license_ids as $license_id ) {
$payment_id = get_post_meta( $license_id, '_edd_sl_payment_id', true );
if ( in_array( $payment_id, $payment_ids ) )
continue;
$payment_ids[] = $payment_id;
}
foreach ( $payment_ids as $payment_id ) {
edd_software_licensing()->update_licenses_on_payment_update( $payment_id );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment