Created
October 15, 2015 20:05
-
-
Save SeanChDavis/e2fcde8053e9e897325a to your computer and use it in GitHub Desktop.
EDD SL License Key Structure
This file contains 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 // DO NOT COPY THIS LINE | |
// SL license key structure based on username, time purchased, md5 | |
function sd_edd_license_usernam_date_md5( $key, $license_id, $download_id, $payment_id, $cart_index ) { | |
$name = get_user_by( 'email', edd_get_payment_user_email( $payment_id ) ); | |
$date = get_post_field( 'post_date', $payment_id ); | |
$timestamp = strtotime($date); | |
$nice_date = date( 'Yndhis', $timestamp ); | |
$license = md5( $license_id ); | |
$key = $name->user_nicename . '_' . $nice_date . '_' . $license; | |
return $key; | |
} | |
add_filter( 'edd_sl_generate_license_key', 'sd_edd_license_usernam_date_md5', 10, 5 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment