Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HappyPlugins/11091602 to your computer and use it in GitHub Desktop.
Save HappyPlugins/11091602 to your computer and use it in GitHub Desktop.
Easy Digital Downloads - Software Licensing Extra Information
<?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