本文整理汇总了PHP中edd_get_users_purchases函数的典型用法代码示例。如果您正苦于以下问题:PHP edd_get_users_purchases函数的具体用法?PHP edd_get_users_purchases怎么用?PHP edd_get_users_purchases使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了edd_get_users_purchases函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ck_edd_user_download_button
function ck_edd_user_download_button($purchase_form, $args)
{
global $edd_options;
if (!is_user_logged_in()) {
return $purchase_form;
}
$download_id = (string) $args['download_id'];
$current_user_id = get_current_user_id();
// If the user has purchased this item, itterate through their purchases to get the specific
// purchase data and pull out the key and email associated with it. This is necessary for the
// generation of the download link
if (edd_has_user_purchased($current_user_id, $download_id, $variable_price_id = null)) {
$user_purchases = edd_get_users_purchases($current_user_id, -1, false, 'complete');
foreach ($user_purchases as $purchase) {
$cart_items = edd_get_payment_meta_cart_details($purchase->ID);
$item_ids = wp_list_pluck($cart_items, 'id');
if (in_array($download_id, $item_ids)) {
$email = edd_get_payment_user_email($purchase->ID);
$payment_key = edd_get_payment_key($purchase->ID);
}
}
$download_ids = array();
if (edd_is_bundled_product($download_id)) {
$download_ids = edd_get_bundled_products($download_id);
} else {
$download_ids[] = $download_id;
}
// Setup the style and colors associated with the settings
$style = isset($edd_options['button_style']) ? $edd_options['button_style'] : 'button';
$color = isset($edd_options['checkout_color']) ? $edd_options['checkout_color'] : 'blue';
$new_purchase_form = '';
foreach ($download_ids as $item) {
// Attempt to get the file data associated with this download
$download_data = edd_get_download_files($item, null);
if ($download_data) {
foreach ($download_data as $filekey => $file) {
// Generate the file URL and then make a link to it
$file_url = edd_get_download_file_url($payment_key, $email, $filekey, $item, null);
$new_purchase_form .= '<a href="' . $file_url . '" class="' . $style . ' ' . $color . ' edd-submit"><span class="edd-add-to-cart-label">Download ' . $file['name'] . '</span></a> ';
}
}
// As long as we ended up with links to show, use them.
if (!empty($new_purchase_form)) {
$purchase_form = '<h4>' . __('You already own this product. Download it now:', 'edd') . '</h4>' . $new_purchase_form;
}
}
}
return $purchase_form;
}
示例2: edd_cr_pages_shortcode
/**
* Displays a list of restricted pages the currently logged-in user has access to
*
* @since 1.5.0
* @param array $atts The attributes to pass to the shortcode
* @param string $content The content of the shortcode
* @return string $content The data to return for the shortcode
*/
function edd_cr_pages_shortcode($atts, $content = null)
{
$atts = shortcode_atts(array('class' => ''), $atts);
if (is_user_logged_in()) {
$pages = array();
$purchases = edd_get_users_purchases(get_current_user_id(), -1);
if ($purchases) {
foreach ($purchases as $purchase) {
$restricted = edd_cr_get_restricted_pages($purchase->ID);
if (empty($restricted)) {
continue;
}
$page_ids = wp_list_pluck($restricted, 'ID');
$pages = array_unique(array_merge($page_ids, $pages));
}
if (!empty($pages)) {
$content = '<ul class="edd_cr_pages">';
foreach ($pages as $page_id) {
$content .= '<li><a href="' . esc_url(get_permalink($page_id)) . '">' . get_the_title($page_id) . '</a></li>';
}
$content .= '</ul>';
} else {
$content = '<div class="edd_cr_no_pages">' . __('You have not purchased access to any content.', 'edd-cr') . '</div>';
}
} else {
$content = '<div class="edd_cr_no_pages">' . __('You have not purchased access to any content.', 'edd-cr') . '</div>';
}
} else {
$content = '<div class="edd_cr_not_logged_in">' . __('You must be logged in to access your purchased content.', 'edd-cr') . '</div>';
}
return $content;
}
示例3: edd_sl_current_user_has_valid_license_for
/**
* Check if the current user has a valid license for the $download_id passed-in.
*
* @param array ( 'download' => Download/Item ID (post_id), 'price_id' => Price ID )
* @return bool true/false
*/
function edd_sl_current_user_has_valid_license_for($download_ids)
{
// Get the current user ID
$current_user_id = get_current_user_id();
// Set default for license validity to false
$license_valid_for_download = false;
// Get the current user's purchases
$user_purchases = edd_get_users_purchases($current_user_id);
if ($user_purchases) {
foreach ($user_purchases as $user_purchase) {
setup_postdata($user_purchase);
// Get all the licenses for all the user's purchases
$sl = edd_software_licensing();
$licenses = $sl->get_licenses_of_purchase($user_purchase->ID);
if (is_array($licenses)) {
foreach ($licenses as $license_post) {
$license_key = get_post_meta($license_post->ID, '_edd_sl_key', true);
foreach ($download_ids as $download_id) {
if ($sl->is_download_id_valid_for_license($download_id['download'], $license_key)) {
$license_status = $sl->get_license_status($license_post->ID);
if ($license_status != 'expired' && $license_post->post_status == 'publish') {
$license_valid_for_download = true;
break;
}
}
}
}
}
wp_reset_postdata();
}
}
return $license_valid_for_download;
}
示例4: edd_get_users_purchases
<?php
$purchases = edd_get_users_purchases();
if ($purchases) {
do_action('edd_before_download_history');
?>
<table id="edd_user_history">
<thead>
<tr class="edd_download_history_row">
<?php
do_action('edd_download_history_header_start');
?>
<th class="edd_download_download_name"><?php
_e('Download Name', 'edd');
?>
</th>
<?php
if (!edd_no_redownload()) {
?>
<th class="edd_download_download_files"><?php
_e('Files', 'edd');
?>
</th>
<?php
}
?>
<?php
do_action('edd_download_history_header_end');
?>
</tr>
</thead>
示例5: dwqa_siteinfo_has_user_purchased
/**
* Has User Purchased
*
* Checks to see if a user has purchased a download.
*
* @access public
* @since 1.0
* @param int $user_id - the ID of the user to check
* @param array $downloads - Array of IDs to check if purchased. If an int is passed, it will be converted to an array
* @param int $variable_price_id - the variable price ID to check for
* @return boolean - true if has purchased and license is active, false otherwise
*/
function dwqa_siteinfo_has_user_purchased($user_id, $downloads, $variable_price_id = null, $verify_purchase = false)
{
$users_purchases = edd_get_users_purchases($user_id);
$return = false;
if (!is_array($downloads) && $downloads !== NULL) {
$downloads = array($downloads);
}
$now = strtotime(date('Y-m-d H:i:s'));
if ($users_purchases) {
foreach ($users_purchases as $purchase) {
$purchased_files = edd_get_payment_meta_downloads($purchase->ID);
$licenses = edd_software_licensing()->get_licenses_of_purchase($purchase->ID);
$licenses_products = array();
if (is_array($licenses)) {
foreach ($licenses as $license) {
$download_id = get_post_meta($license->ID, '_edd_sl_download_id', true);
$status = get_post_meta($license->ID, '_edd_sl_status', true);
$expire = get_post_meta($license->ID, '_edd_sl_expiration', true);
$licenses_products[$download_id] = array();
$licenses_products[$download_id]['status'] = $status;
$licenses_products[$download_id]['expire'] = $expire;
}
} else {
return false;
}
if (is_array($purchased_files)) {
foreach ($purchased_files as $download) {
if ($downloads === NULL || in_array($download['id'], $downloads)) {
//check to see if the license is active
//echo $licenses_products[$download['id']]['expire'] . ">" . $now . "==========";
if (isset($licenses_products[$download['id']]['expire']) && $now > $licenses_products[$download['id']]['expire']) {
// || $licenses_products[$download['id']]['status'] == 'inactive'
if ($verify_purchase) {
return "purchased_expired";
} else {
return false;
}
}
$variable_prices = edd_has_variable_prices($download['id']);
if ($variable_prices && !is_null($variable_price_id) && $variable_price_id !== false) {
if (isset($download['options']['price_id']) && $variable_price_id == $download['options']['price_id']) {
return true;
} else {
return false;
}
} else {
return true;
}
}
}
}
}
}
return false;
}
示例6: edd_bbp_sidebar
/**
* EDD Forum Sidebar
*
* @since 1.0.0
* @return void
*/
function edd_bbp_sidebar()
{
global $post;
$user_id = get_the_author_meta('ID');
$user_data = get_userdata($user_id);
?>
<div class="box">
<?php
do_action('edd_bbp_sidebar');
?>
<h3><?php
echo get_the_author_meta('first_name') . ' ' . get_the_author_meta('last_name');
?>
</h3>
<p class="bbp-user-forum-role"><?php
printf('Forum Role: %s', bbp_get_user_display_role($user_id));
?>
</p>
<p class="bbp-user-topic-count"><?php
printf('Topics Started: %s', bbp_get_user_topic_count_raw($user_id));
?>
</p>
<p class="bbp-user-reply-count"><?php
printf('Replies Created: %s', bbp_get_user_reply_count_raw($user_id));
?>
</p>
<div class="rcp_support_status">
<h4>Priority Support Access</h4>
<?php
if (function_exists('rcp_is_active')) {
if (rcp_is_active($user_id)) {
?>
<p>Has <strong>Priority Support</strong> access.</p>
<?php
} elseif (rcp_is_expired($user_id)) {
?>
<p><strong>Priority Support</strong> access has <span style="color:red;">expired</span>.</p>
<?php
} else {
?>
<p>Has no priority support accesss</p>
<?php
}
}
?>
</div><!-- /.rcp_support_status -->
<div class="edd_users_purchases">
<h4>User's Purchases:</h4>
<?php
$purchases = edd_get_users_purchases($user_data->user_email, 100, false, 'any');
if ($purchases) {
echo '<ul>';
foreach ($purchases as $purchase) {
echo '<li>';
echo '<strong><a href="' . admin_url('edit.php?post_type=download&page=edd-payment-history&view=view-order-details&id=' . $purchase->ID) . '">#' . $purchase->ID . ' - ' . edd_get_payment_status($purchase, true) . '</a></strong><br/>';
$downloads = edd_get_payment_meta_downloads($purchase->ID);
foreach ($downloads as $download) {
echo get_the_title($download['id']) . ' - ' . date('F j, Y', strtotime($purchase->post_date)) . '<br/>';
}
if (function_exists('edd_software_licensing')) {
$licenses = edd_software_licensing()->get_licenses_of_purchase($purchase->ID);
if ($licenses) {
echo '<strong>Licenses:</strong><br/>';
foreach ($licenses as $license) {
$key = edd_software_licensing()->get_license_key($license->ID);
echo '<a href="' . admin_url('edit.php?post_type=download&page=edd-licenses&s=' . $key) . '">' . $key . '</a>';
echo ' - ' . edd_software_licensing()->get_license_status($license->ID);
echo '<br/>';
}
}
echo '<hr/>';
}
echo '</li>';
}
echo '</ul>';
} else {
echo '<p>This user has never purchased anything.</p>';
}
?>
</div>
</div>
<?php
}
示例7: edd_userpro_embed_profile_fields
function edd_userpro_embed_profile_fields($hook_args)
{
if (!current_user_can('edit_user', $hook_args['user_id'])) {
return;
}
echo '<div class="userpro-section userpro-column userpro-collapsible-1 userpro-collapsed-1">' . __('Purchase History', 'edd-userpro-embed') . '</div>';
echo '<div class="userpro-field userpro-field-edd-purchase-history userpro-field-view" data-key="edd-purchase-history">';
$purchases = edd_get_users_purchases($hook_args['user_id'], 99999, true, 'any');
if ($purchases) {
do_action('edd_before_purchase_history');
?>
<table id="edd_user_history">
<thead>
<tr class="edd_purchase_row">
<?php
do_action('edd_purchase_history_header_before');
?>
<th class="edd_purchase_id"><?php
_e('ID', 'easy-digital-downloads');
?>
</th>
<th class="edd_purchase_date"><?php
_e('Date', 'easy-digital-downloads');
?>
</th>
<th class="edd_purchase_amount"><?php
_e('Amount', 'easy-digital-downloads');
?>
</th>
<th class="edd_purchase_details"><?php
_e('Details', 'easy-digital-downloads');
?>
</th>
<?php
do_action('edd_purchase_history_header_after');
?>
</tr>
</thead>
<?php
foreach ($purchases as $post) {
setup_postdata($post);
?>
<?php
$purchase_data = edd_get_payment_meta($post->ID);
?>
<tr class="edd_purchase_row">
<?php
do_action('edd_purchase_history_row_start', $post->ID, $purchase_data);
?>
<td class="edd_purchase_id">#<?php
echo edd_get_payment_number($post->ID);
?>
</td>
<td class="edd_purchase_date"><?php
echo date_i18n(get_option('date_format'), strtotime(get_post_field('post_date', $post->ID)));
?>
</td>
<td class="edd_purchase_amount">
<span class="edd_purchase_amount"><?php
echo edd_currency_filter(edd_format_amount(edd_get_payment_amount($post->ID)));
?>
</span>
</td>
<td class="edd_purchase_details">
<?php
if ($post->post_status != 'publish') {
?>
<span class="edd_purchase_status <?php
echo $post->post_status;
?>
"><?php
echo edd_get_payment_status($post, true);
?>
</span>
<a href="<?php
echo esc_url(add_query_arg('payment_key', edd_get_payment_key($post->ID), edd_get_success_page_uri()));
?>
">»</a>
<?php
} else {
?>
<a href="<?php
echo esc_url(add_query_arg('payment_key', edd_get_payment_key($post->ID), edd_get_success_page_uri()));
?>
"><?php
_e('View Details', 'edd-userpro-embed');
?>
</a>
<?php
}
?>
</td>
<?php
do_action('edd_purchase_history_row_end', $post->ID, $purchase_data);
?>
</tr>
<?php
}
?>
</table>
//.........这里部分代码省略.........
示例8: do_shortcode
?>
<div role="tabpanel" class="tab-pane" id="downloads"><?php
echo do_shortcode('[download_history]');
?>
</div>
<div role="tabpanel" class="tab-pane" id="profile"><?php
echo do_shortcode('[edd_profile_editor]');
?>
</div>
<div role="tabpanel" class="tab-pane" id="subscriptions">
<?php
/**
* This template is used to display the purchase history of the current user.
*/
$subscriptions = edd_get_users_purchases(get_current_user_id(), 20, true, 'any');
if ($subscriptions) {
do_action('edd_before_purchase_history');
?>
<table id="edd_user_history" class="table table-striped table-hover table-responsive">
<thead>
<tr class="edd_purchase_row">
<?php
do_action('edd_purchase_history_header_before');
?>
<th class="edd_purchase_id"><?php
_e('ID', 'edd');
?>
</th>
<th class="edd_purchase_date"><?php
_e('Date', 'edd');
示例9: edd_pl_get_user_purchase_count
/**
* Get user purchase count for download
*
* @since 1.0.1
* @param int $user_id the ID of the user to check
* @param int $download_id the download ID to check
* @param int $variable_price_id the variable price ID to check
* @return int $count the number of times the product has been purchased
*/
function edd_pl_get_user_purchase_count($user_id, $download_id, $variable_price_id = null)
{
if (!is_user_logged_in()) {
return 0;
}
$users_purchases = edd_get_users_purchases($user_id, 999);
$count = 0;
$download_id = array($download_id);
if ($users_purchases) {
foreach ($users_purchases as $purchase) {
$purchased_files = edd_get_payment_meta_downloads($purchase->ID);
if (is_array($purchased_files)) {
foreach ($purchased_files as $download) {
if (isset($download['id']) && in_array($download['id'], $download_id)) {
$count++;
}
}
}
}
}
return $count;
}
示例10: widget
/** @see WP_Widget::widget */
function widget($args, $instance)
{
extract($args);
$title = apply_filters('widget_title', $instance['title']);
global $user_ID, $edd_options;
if (is_user_logged_in()) {
$purchases = edd_get_users_purchases($user_ID);
if ($purchases) {
echo $before_widget;
if ($title) {
echo $before_title . $title . $after_title;
}
foreach ($purchases as $purchase) {
$purchase_data = edd_get_payment_meta($purchase->ID);
$downloads = edd_get_payment_meta_downloads($purchase->ID);
if ($downloads) {
foreach ($downloads as $download) {
$id = isset($purchase_data['cart_details']) ? $download['id'] : $download;
$price_id = isset($download['options']['price_id']) ? $download['options']['price_id'] : null;
$download_files = edd_get_download_files($id, $price_id);
echo '<div class="edd-purchased-widget-purchase edd-purchased-widget-purchase-' . $purchase->ID . '" id="edd-purchased-widget-purchase-' . $id . '">';
echo '<div class="edd-purchased-widget-purchase-name">' . get_the_title($id) . '</div>';
echo '<ul class="edd-purchased-widget-file-list">';
if (!edd_no_redownload()) {
if ($download_files) {
foreach ($download_files as $filekey => $file) {
$download_url = edd_get_download_file_url($purchase_data['key'], $purchase_data['email'], $filekey, $id, $price_id);
echo '<li class="edd-purchased-widget-file"><a href="' . $download_url . '" class="edd-purchased-widget-file-link">' . $file['name'] . '</a></li>';
}
} else {
echo '<li class="edd-purchased-widget-no-file">' . __('No downloadable files found.', 'edd');
}
}
echo '</ul>';
echo '</div>';
}
}
}
}
echo $after_widget;
}
}
示例11: get_current_user_id
*/
$user_id = get_current_user_id();
$args = array('post_type' => 'download', 'post_status' => 'publish', 'order' => 'ASC', 'author' => $user_id);
$products = get_posts($args);
$downloaded_user_id_array = array();
if (!empty($products)) {
foreach ($products as $key => $product) {
$puchase_ids = get_payment_ids($product->ID);
foreach ($puchase_ids as $puchase_ids_key => $puchase_id) {
$downloaded_user_id = get_post_meta($puchase_id, '_edd_payment_user_id');
$downloaded_user_id_array[] = $downloaded_user_id[0];
}
}
$downloaded_user_id_array = array_unique($downloaded_user_id_array);
for ($i = 0; $i <= count($downloaded_user_id_array); $i++) {
$customer_purchases = edd_get_users_purchases($downloaded_user_id_array[$i], 20, true, 'any');
$author_obj = get_user_by('id', $downloaded_user_id_array[$i]);
$customer_name = $author_obj->data->display_name;
if ($customer_name == '') {
$customer_name = $author_obj->data->user_nicename;
}
if ($customer_purchases) {
do_action('edd_before_download_history');
?>
<table id="edd_user_history" class="edd-table">
<?php
//if ($i == 0) {
?>
<thead>
<tr class="edd_download_history_row">
示例12: edd_has_purchases
/**
* Has Purchases
*
* Checks to see if a user has purchased at least one item.
*
* @access public
* @since 1.0
* @param $user_id int - the ID of the user to check
* @return bool - true if has purchased, false other wise.
*/
function edd_has_purchases($user_id = null)
{
if (is_null($user_id)) {
global $user_ID;
$user_id = $user_ID;
}
if (edd_get_users_purchases($user_id, 1)) {
return true;
// user has at least one purchase
}
return false;
// user has never purchased anything
}
示例13: edd_wl_get_purchases
/**
* Get a customer's purchases
* @param [type] $user_id [description]
* @param [type] $download_id [description]
* @param [type] $variable_price_id [description]
* @since 1.0
* @return [type] [description]
*/
function edd_wl_get_purchases($user_id, $download_id, $variable_price_id = null)
{
$users_purchases = edd_get_users_purchases($user_id);
$return = false;
if ($users_purchases) {
foreach ($users_purchases as $purchase) {
$purchased_files = edd_get_payment_meta_downloads($purchase->ID);
if (is_array($purchased_files)) {
foreach ($purchased_files as $download) {
$variable_prices = edd_has_variable_prices($download['id']);
if ($variable_prices && !is_null($variable_price_id) && $variable_price_id !== false) {
if (isset($download['options']['price_id']) && $variable_price_id == $download['options']['price_id']) {
$return = true;
break 2;
} else {
$return = false;
}
} elseif ($download_id == $download['id']) {
$return = true;
}
}
}
}
}
return $return;
}
示例14: wi_bbp_sidebar
/**
* Forum Sidebar
*
* @since 1.0.0
* @return void
*/
function wi_bbp_sidebar()
{
global $post;
$user_id = get_the_author_meta('ID');
$user_data = get_userdata($user_id);
?>
<div class="box">
<?php
do_action('wi_bbp_sidebar');
?>
<h3><?php
echo get_the_author_meta('first_name') . ' ' . get_the_author_meta('last_name');
?>
</h3>
<p class="bbp-user-forum-role"><?php
printf('Forum Role: %s', bbp_get_user_display_role($user_id));
?>
</p>
<p class="bbp-user-topic-count"><?php
printf('Topics Started: %s', bbp_get_user_topic_count_raw($user_id));
?>
</p>
<p class="bbp-user-reply-count"><?php
printf('Replies Created: %s', bbp_get_user_reply_count_raw($user_id));
?>
</p>
<div class="wi_users_purchases">
<h3><?php
_e('User\'s Purchases:', 'wi_bbp');
?>
</h3>
<?php
$purchases = edd_get_users_purchases($user_data->user_email, 100, false, 'any');
if ($purchases) {
echo '<ul>';
foreach ($purchases as $purchase) {
echo '<li>';
echo '<strong><a href="' . admin_url('edit.php?post_type=download&page=give-payment-history&view=view-order-details&id=' . $purchase->ID) . '">#' . $purchase->ID . ' - ' . edd_get_payment_status($purchase, true) . '</a></strong><br/>';
$downloads = edd_get_payment_meta_downloads($purchase->ID);
foreach ($downloads as $download) {
echo get_the_title($download['id']) . ' - ' . date('F j, Y', strtotime($purchase->post_date)) . '<br/>';
}
//Check license key
if (function_exists('edd_software_licensing')) {
$licenses = edd_software_licensing()->get_licenses_of_purchase($purchase->ID);
if ($licenses) {
echo '<strong>Licenses:</strong><br/>';
foreach ($licenses as $license) {
$key = edd_software_licensing()->get_license_key($license->ID);
echo '<a href="' . admin_url('edit.php?post_type=download&page=give-licenses&s=' . $key) . '">' . $key . '</a>';
echo ' - ' . edd_software_licensing()->get_license_status($license->ID);
echo '<br/>';
}
}
echo '<hr/>';
}
echo '</li>';
}
echo '</ul>';
} else {
echo '<p>This user has never purchased anything.</p>';
}
?>
</div>
</div>
<?php
}
示例15: widget
/**
* Front-end display of widget.
*
* @see WP_Widget::widget()
*
* @param array $args Widget arguments.
* @param array $instance Saved values from database.
*/
public function widget($args, $instance)
{
//No EDD? Bail
if (!class_exists('Easy_Digital_Downloads')) {
return false;
}
//Not EDD admin? Bail
if (!current_user_can('view_shop_sensitive_data')) {
return false;
}
//Handle before_widget args
echo $args['before_widget'];
if (!empty($instance['title'])) {
echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title'];
}
$user_id = get_the_author_meta('ID');
$user_data = get_userdata($user_id);
?>
<div class="box">
<?php
do_action('wi_bbp_sidebar');
?>
<h3><?php
echo get_the_author_meta('first_name') . ' ' . get_the_author_meta('last_name');
?>
</h3>
<p class="bbp-user-forum-role"><?php
printf('Forum Role: %s', bbp_get_user_display_role($user_id));
?>
</p>
<p class="bbp-user-topic-count"><?php
printf('Topics Started: %s', bbp_get_user_topic_count_raw($user_id));
?>
</p>
<p class="bbp-user-reply-count"><?php
printf('Replies Created: %s', bbp_get_user_reply_count_raw($user_id));
?>
</p>
<div class="wi_users_purchases">
<h3><?php
_e('User\'s Purchases:', 'wi_bbp');
?>
</h3>
<?php
$purchases = edd_get_users_purchases($user_data->user_email, 100, false, 'any');
if ($purchases) {
echo '<ul>';
foreach ($purchases as $purchase) {
echo '<li>';
echo '<strong><a href="' . admin_url('edit.php?post_type=download&page=give-payment-history&view=view-order-details&id=' . $purchase->ID) . '">#' . $purchase->ID . ' - ' . edd_get_payment_status($purchase, true) . '</a></strong><br/>';
$downloads = edd_get_payment_meta_downloads($purchase->ID);
foreach ($downloads as $download) {
echo get_the_title($download['id']) . ' - ' . date('F j, Y', strtotime($purchase->post_date)) . '<br/>';
}
//Check license key
if (function_exists('edd_software_licensing')) {
$licenses = edd_software_licensing()->get_licenses_of_purchase($purchase->ID);
if ($licenses) {
echo '<strong>' . __('Licenses:', 'edd') . '</strong><br/>';
foreach ($licenses as $license) {
$key = edd_software_licensing()->get_license_key($license->ID);
$download_id = edd_software_licensing()->get_download_by_license($key);
$title = get_the_title($download_id);
//output license URL
echo $title . ' - <a href="' . admin_url('edit.php?post_type=download&page=give-licenses&s=' . $key) . '">' . $key . '</a>';
echo ' - ' . edd_software_licensing()->get_license_status($license->ID);
echo '<br/>';
}
}
echo '<hr/>';
}
echo '</li>';
}
echo '</ul>';
} else {
echo '<p>' . __('This user has never purchased anything.', 'wi_bbp') . '</p>';
}
?>
</div>
</div>
<?php
//After widget args
echo $args['after_widget'];
return false;
}