Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
/*
* Check if user has a valid subscription
*/
function wpzoo_edd_is_active_customer( $user_id = '' ) {
// Fail gracefully if EDD Software Licencing not active
if ( ! function_exists('edd_software_licensing') ) {
return;
}
$license_keys = edd_software_licensing()->get_license_keys_of_user( $user_id );
foreach ( $license_keys as $license ) {
$status = edd_software_licensing()->get_license_status( $license->ID );
$post_status = get_post_status( $license->ID );
if ( 'expired' !== $status && 'publish' === $post_status ) {
return true;
}
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment