Last active
September 5, 2024 01:47
-
-
Save HappyPlugins/11091602 to your computer and use it in GitHub Desktop.
Easy Digital Downloads - Software Licensing Extra Information
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 | |
/* | |
Plugin Name: EDD Software Licensing - Extra Returned Information | |
Plugin URI: http://happyplugings.com | |
Description: Add extra information for EDD Software Licesing plugin | |
Author: HappyPlugins | |
Version: 1.0.1 | |
Author URI: http://happyplugins.com | |
*/ | |
/* Add extra variables to the return information when a product is activated */ | |
add_filter ('edd_remote_license_activation_response' , 'license_activation_extra_variables' , 10 , 3); | |
function license_activation_extra_variables ($results, $args, $license_id) { | |
$edd_sl = edd_software_licensing(); | |
$key = $args['key']; | |
$download_id = $edd_sl ->get_download_by_license( $key ); | |
$extra_information = array ( | |
'purchase_date' => get_the_time( get_option( 'date_format' ), $license_id ), | |
'license_limit' => $edd_sl->get_license_limit($download_id, $license_id) , | |
'license_count' => $edd_sl->get_site_count($license_id), | |
'date_format' => get_option( 'date_format' ), | |
); | |
return array_merge( $results, $extra_information); | |
} | |
/* Add extra variables to the return information when a product license is checked */ | |
add_filter ('edd_remote_license_check_response' , 'license_check_extra_variables' , 10 , 3); | |
function license_check_extra_variables ($results , $args, $license_id) { | |
$edd_sl = edd_software_licensing(); | |
$key = $args['key']; | |
$download_id = $edd_sl->get_download_by_license( $key ); | |
$extra_information = array ( | |
'purchase_date' => get_the_time( get_option( 'date_format' ), $license_id ), | |
'license_limit' => $edd_sl->get_license_limit($download_id, $license_id) , | |
'license_count' => $edd_sl->get_site_count($license_id), | |
'date_format' => get_option( 'date_format' ), | |
); | |
return array_merge( $results, $extra_information); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment