Created
March 1, 2016 21:04
-
-
Save grappler/6d56e3da3dfde689c419 to your computer and use it in GitHub Desktop.
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 | |
/* | |
* 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