<td class="edd_purchase_id">#<?php 
        echo absint($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"><?php 
        echo edd_currency_filter($purchase_data['amount']);
        ?>
</td>
				<td class="edd_purchased_files">
					<?php 
        // show a list of downloadable files
        $downloads = edd_get_downloads_of_purchase($post->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_download_name">' . esc_html(get_the_title($id)) . '</div>';
                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);
                            echo '<div class="edd_download_file"><a href="' . esc_url($download_url) . '" class="edd_download_file_link">' . esc_html($file['name']) . '</a></div>';
                        }
                    } else {
                        _e('No downloadable files found.', 'edd');
                    }
 /** @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 = get_post_meta($purchase->ID, '_edd_payment_meta', true);
                 $downloads = edd_get_downloads_of_purchase($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);
                                     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;
     }
 }