Skip to content

Commit

Permalink
Add support for lifetime licenses. Closes #22 closes #23
Browse files Browse the repository at this point in the history
  • Loading branch information
dannyvankooten committed Sep 6, 2015
1 parent 16ef7e8 commit cf1e548
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions includes/Endpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,15 @@ private function build_response_html() {
$license = $licensing->get_license_by_purchase( $order['id'], $download['id'] );

if( is_object( $license ) ) {
$key = get_post_meta( $license->ID, '_edd_sl_key', true );
$expires = get_post_meta( $license->ID, '_edd_sl_expiration', true );
$is_expired = $expires < time();
$key = (string) get_post_meta( $license->ID, '_edd_sl_key', true );

// add support for "lifetime" licenses
if ( method_exists( $licensing, 'is_lifetime_license' ) && $licensing->is_lifetime_license( $license->ID ) ) {
$is_expired = false;
} else {
$expires = (string) get_post_meta( $license->ID, '_edd_sl_expiration', true );
$is_expired = $expires < time();
}

$order['downloads'][$key]['license'] = array(
'key' => $key,
Expand Down

0 comments on commit cf1e548

Please sign in to comment.