Skip to content

Instantly share code, notes, and snippets.

@grappler
Created March 1, 2016 21:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grappler/6d56e3da3dfde689c419 to your computer and use it in GitHub Desktop.
Save grappler/6d56e3da3dfde689c419 to your computer and use it in GitHub Desktop.
<?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