Skip to main content
PRO Only
Pro Feature

This feature is only available in the Pro edition. Upgrade to Pro to access account history.

Pro: Account History

Account History displays a user's free download history on their WooCommerce My Account page. Users can view all their past downloads, see download dates, and re-download files—providing transparency and convenience.

Overview

The Account History feature:

  • Displays user's download history on My Account page
  • Shows product names, download dates, and file counts
  • Provides re-download links for past downloads
  • Displays download limits and remaining quota
  • Integrates seamlessly with WooCommerce My Account

How It Works

Display Location

Download history appears on:

WooCommerce My Account Page:

  • New tab: "Free Downloads"
  • Or section within Downloads tab
  • Configurable location

Shortcode:

  • Display anywhere with [somdn_user_free_downloads_history]
  • Custom pages
  • Widgets

What Users See

Download History Table:

  • Product name
  • Download date
  • Number of files
  • Re-download button

Download Limits:

  • Current usage
  • Total allowance
  • Remaining downloads
  • Reset date

Enabling Account History

Settings Location

Go to WP Enhanced > Free Download Woo, then click Tracking in the sidebar

Enable History

  1. Check "Enable download tracking" (required)
  2. History automatically appears on My Account page
  3. No additional configuration needed

Requirements

Account History requires:

  • Download Tracking enabled
  • User must be logged in
  • At least one download logged

My Account Integration

Tab Configuration

Default Behavior:

  • Adds "Free Downloads" tab to My Account
  • Appears after standard WooCommerce tabs
  • Shows download history and limits

Customization:

// Change tab title
add_filter('somdn_account_tab_title', function($title) {
return 'My Free Downloads';
});

// Change tab priority (order)
add_filter('somdn_account_tab_priority', function($priority) {
return 25; // Higher = later in menu
});

Tab Content

The tab displays:

  1. Download Limits Section (if limits enabled)

    • Current downloads this period
    • Total allowance
    • Remaining downloads
    • Reset date
  2. Download History Table

    • All user's downloads
    • Sorted by date (newest first)
    • Pagination for many downloads

Placeholder: Screenshot of account tab

Download History Table

Table Columns

Product:

  • Product name
  • Links to product page
  • Variation name (if applicable)

Date:

  • Download date and time
  • Formatted per WordPress settings
  • Sortable

Files:

  • Number of files downloaded
  • File names (optional)
  • File sizes (optional)

Actions:

  • Re-download button
  • View details link (optional)

Pagination

For users with many downloads:

  • 10 downloads per page (default)
  • Previous/Next navigation
  • Page numbers
  • Configurable per page count
add_filter('somdn_history_per_page', function($per_page) {
return 25; // Show 25 per page
});

Sorting

Sort downloads by:

  • Date (default)
  • Product name
  • File count
add_filter('somdn_history_orderby', function($orderby) {
return 'product_name'; // Sort by product
});

Re-Download Functionality

How Re-Download Works

When user clicks re-download:

  1. Validates user owns this download
  2. Checks download limits (if enabled)
  3. Retrieves original files
  4. Initiates download
  5. Logs new download (optional)

Re-Download Limits

Unlimited Re-Downloads (Default):

  • Users can re-download anytime
  • No additional limits
  • Doesn't count toward download limits

Count Re-Downloads:

add_filter('somdn_count_redownloads', '__return_true');

This makes re-downloads count toward download limits.

Disable Re-Downloads

Prevent re-downloading:

add_filter('somdn_allow_redownload', '__return_false');

Or conditionally:

add_filter('somdn_allow_redownload', function($allow, $download_id) {
// Only allow re-download within 30 days
$download_date = get_post_time('U', false, $download_id);
$days_ago = (time() - $download_date) / DAY_IN_SECONDS;

return $days_ago <= 30;
}, 10, 2);

Download Limits Display

Limits Section

When download limits are enabled, users see:

Current Usage:

  • "You have downloaded X files today"
  • Real-time count

Allowance:

  • "Your limit is Y downloads per day"
  • Based on user's applicable limit

Remaining:

  • "You have Z downloads remaining"
  • Calculated automatically

Reset:

  • "Your limit resets in X hours"
  • Countdown to reset time

Placeholder: Screenshot of limits display

Shortcode

Display limits anywhere:

[download_limits]

Shows same information as account page.

Customization

Customize limits display:

add_filter('somdn_limits_display_text', function($text, $current, $limit, $remaining) {
return "You've used {$current} of {$limit} downloads. {$remaining} left!";
}, 10, 4);

Shortcode Usage

Display History Anywhere

Use shortcode to display history on any page:

[somdn_user_free_downloads_history]

Use Cases:

  • Custom account page
  • Dashboard widget
  • Member portal
  • Profile page

Shortcode Attributes

Limit number of downloads:

[somdn_user_free_downloads_history limit="5"]

Show only recent downloads:

[somdn_user_free_downloads_history days="30"]

Hide re-download buttons:

[somdn_user_free_downloads_history show_redownload="false"]

For Non-Logged-In Users

If user is not logged in:

  • Shows login prompt
  • Or custom message
  • No download history displayed
add_filter('somdn_history_login_message', function($message) {
return 'Please <a href="/my-account/">log in</a> to view your download history.';
});

Customizing Display

Template Override

Override the history template:

  1. Copy template from plugin:

    /plugins/free-downloads-woocommerce-pro/templates/account-history.php
  2. Paste to theme:

    /themes/your-theme/free-downloads-woocommerce/account-history.php
  3. Customize as needed

Custom Styling

Add custom CSS:

/* History table */
.somdn-account-history-table {
width: 100%;
border-collapse: collapse;
}

/* Table headers */
.somdn-account-history-table th {
background: #f5f5f5;
padding: 10px;
text-align: left;
}

/* Table rows */
.somdn-account-history-table td {
padding: 10px;
border-bottom: 1px solid #eee;
}

/* Re-download button */
.somdn-redownload-button {
background: #0073aa;
color: white;
padding: 8px 16px;
border-radius: 4px;
}

Hide Specific Columns

Remove columns from table:

add_filter('somdn_history_columns', function($columns) {
unset($columns['files']); // Remove files column
return $columns;
});

Add Custom Columns

Add new columns:

add_filter('somdn_history_columns', function($columns) {
$columns['product_price'] = 'Price';
return $columns;
});

add_filter('somdn_history_column_product_price', function($value, $download_id) {
$product_id = get_post_meta($download_id, 'somdn_product_id', true);
$product = wc_get_product($product_id);
return $product ? $product->get_price_html() : '';
}, 10, 2);

Privacy Considerations

User Data

Download history contains:

  • Products downloaded
  • Download dates
  • IP addresses (in logs)
  • User information

GDPR Compliance

User Rights:

  • View their data (via account page)
  • Export their data (via WooCommerce export)
  • Delete their data (via WooCommerce erasure)

Data Retention:

  • Keep only as long as needed
  • Delete on user request
  • Anonymize old data

Data Deletion

Delete user's download history:

// On user deletion
add_action('delete_user', function($user_id) {
$downloads = get_posts(array(
'post_type' => 'somdn_tracked',
'meta_key' => 'somdn_user_id',
'meta_value' => $user_id,
'posts_per_page' => -1,
'fields' => 'ids'
));

foreach ($downloads as $download_id) {
wp_delete_post($download_id, true);
}
});

Use Cases

Customer Service

Support Benefits:

  • Verify user downloaded product
  • Check download dates
  • Troubleshoot download issues
  • Provide re-download links

User Convenience

User Benefits:

  • Access past downloads anytime
  • Re-download lost files
  • Track download history
  • See download limits

Transparency

Trust Building:

  • Show users their data
  • Provide download records
  • Display clear limits
  • Enable self-service

Compliance

Legal Requirements:

  • Provide data access
  • Enable data export
  • Support data deletion
  • Document data usage

Troubleshooting

History Not Showing

If history doesn't appear:

  1. ✅ Verify tracking is enabled
  2. ✅ Check user is logged in
  3. ✅ Confirm user has downloads
  4. ✅ Clear all caches
  5. ✅ Check My Account page is working

Re-Download Not Working

If re-download fails:

  1. ✅ Check files still exist
  2. ✅ Verify user permissions
  3. ✅ Check download limits
  4. ✅ Look for PHP errors
  5. ✅ Test with different file

Limits Not Displaying

If limits don't show:

  1. ✅ Verify limits are enabled
  2. ✅ Check user has applicable limit
  3. ✅ Clear caches
  4. ✅ Check template override
  5. ✅ Look for JavaScript errors

Wrong Downloads Showing

If wrong downloads appear:

  1. ✅ Verify user ID is correct
  2. ✅ Check for user switching plugins
  3. ✅ Clear object cache
  4. ✅ Review custom filters
  5. ✅ Test with different user

Developer Hooks

Filters

somdn_account_tab_title Change My Account tab title.

add_filter('somdn_account_tab_title', function($title) {
return 'Download History';
});

somdn_history_per_page Change pagination count.

add_filter('somdn_history_per_page', function($per_page) {
return 20;
});

somdn_allow_redownload Control re-download permission.

add_filter('somdn_allow_redownload', function($allow, $download_id) {
// Your logic
return $allow;
}, 10, 2);

somdn_history_columns Modify table columns.

add_filter('somdn_history_columns', function($columns) {
// Add or remove columns
return $columns;
});

Actions

somdn_before_account_history Before history table.

add_action('somdn_before_account_history', function($user_id) {
echo '<p>Your download history:</p>';
});

somdn_after_account_history After history table.

add_action('somdn_after_account_history', function($user_id) {
echo '<p>Need help? <a href="/contact/">Contact us</a></p>';
});

somdn_redownload_success After successful re-download.

add_action('somdn_redownload_success', function($download_id, $user_id) {
// Log re-download
}, 10, 2);

Best Practices

User Experience

  • Clear display: Show relevant information
  • Easy re-download: Make re-downloading simple
  • Helpful limits: Display limits clearly
  • Mobile friendly: Ensure mobile compatibility

Performance

  • Pagination: Don't load all downloads at once
  • Caching: Cache user's download count
  • Efficient queries: Optimize database queries
  • Lazy loading: Load history on demand

Privacy

  • Secure access: Verify user permissions
  • Data protection: Protect download history
  • Clear policy: Document data usage
  • User control: Let users manage their data

Support

  • Documentation: Link to help docs
  • Contact info: Provide support contact
  • FAQs: Answer common questions
  • Self-service: Enable user self-service