Skip to main content
PRO Only
Pro Feature

This feature is only available in the Pro edition. Upgrade to Pro to access download limits.

Pro: Download Limits

Download Limits restrict how many free downloads users can access within a specific time period. This prevents abuse, manages server resources, and encourages upgrades to paid plans or memberships.

Overview​

Download Limits allow you to:

  • Set daily, weekly, monthly, or yearly download quotas
  • Apply limits globally or per-product
  • Customize limits by user role, membership plan, or individual user
  • Track limit usage in real-time
  • Display remaining downloads to users

How It Works​

Limit Enforcement​

When a user attempts to download:

  1. Plugin checks if limits are enabled
  2. Identifies applicable limit (user > membership > role > global)
  3. Counts recent downloads within time period
  4. Compares count against limit
  5. Allows or blocks download
  6. Displays error message if limit reached

Time Periods​

Limits reset automatically:

  • Daily: Resets at midnight
  • Weekly: Resets every 7 days from first download
  • Monthly: Resets every 30 days from first download
  • Yearly: Resets every 365 days from first download

Limit Priority​

When multiple limits apply, priority order:

  1. Individual User Limits (highest priority)
  2. Membership Plan Limits
  3. User Role Limits
  4. Global Limits (lowest priority)

The most restrictive applicable limit is enforced.

Setting Up Download Limits​

Enable Limits​

  1. Go to WP Enhanced > Free Download Woo, then click Download Limits in the sidebar
  2. Check "Enable download limits"
  3. Configure limit settings
  4. Save changes

Global Limits​

Set default limits for all users:

Limit Type:

  • User ID: Track by logged-in user account (recommended)
  • IP Address: Track by IP address (for guests)

Frequency:

  • Daily
  • Weekly
  • Monthly
  • Yearly

Amount:

  • Number of downloads allowed per period

Products:

  • All products
  • Specific products only

Login Required:

  • Require login to enforce User ID limits
  • Optional for IP-based limits

Error Message:

  • Custom message shown when limit reached

Example Configuration​

Basic Setup:

Limit Type: User ID
Frequency: Daily
Amount: 5
Products: All products
Login Required: Yes
Error Message: "You've reached your daily download limit of 5. Please try again tomorrow."

This allows 5 downloads per day per user across all products.

User Role Limits​

Setting Role-Based Limits​

Customize limits by WordPress user role:

  1. Go to Download Limits > User Role Limits
  2. Select role (Subscriber, Customer, etc.)
  3. Set frequency and amount
  4. Choose products
  5. Save settings

Example Role Limits​

Free Users (Subscriber):

  • 3 downloads per day
  • All products

Customers (Purchased something):

  • 10 downloads per day
  • All products

VIP Members:

  • Unlimited downloads
  • All products

Excluding Roles​

Exclude specific roles from limits:

add_filter('somdn_user_limits_excluded', function($excluded, $user_id) {
$user = get_user_by('id', $user_id);
if (in_array('administrator', $user->roles)) {
return true; // Exclude administrators
}
return $excluded;
}, 10, 2);

Membership Plan Limits​

WooCommerce Memberships Integration​

Set custom limits per membership plan:

  1. Go to WooCommerce > Memberships > Membership Plans
  2. Edit a membership plan
  3. Scroll to "Free Download Limits" meta box
  4. Configure limits for this plan
  5. Save plan

Free Trial Limits​

Set different limits during free trial:

Trial Period:

  • 2 downloads per day

After Trial:

  • 10 downloads per day

This encourages trial users to upgrade to paid membership.

Example Membership Limits​

Basic Membership:

  • 5 downloads per day
  • Selected products only

Premium Membership:

  • 20 downloads per day
  • All products

Enterprise Membership:

  • Unlimited downloads
  • All products

See WooCommerce Memberships Integration for details.

Individual User Limits​

Custom Limits Per User​

Set unique limits for specific users:

  1. Go to Users > All Users
  2. Edit a user
  3. Scroll to "Free Download Limits" section
  4. Set custom limits
  5. Save user

Use Cases​

Beta Testers:

  • Unlimited downloads for testing

Problem Users:

  • Reduced limits for abuse prevention

VIP Customers:

  • Increased limits as reward

Partners:

  • Custom limits per agreement

Product-Specific Limits​

Limit Specific Products​

Apply limits to selected products only:

  1. In limit settings, choose "Specific products"
  2. Select products from dropdown
  3. Save settings

Users can download unlimited times from products not in the list.

Example Product Limits​

Premium Content:

  • 2 downloads per week
  • Only premium eBooks

Basic Content:

  • Unlimited downloads
  • All other products

Per-Product Limits​

Set different limits for different products:

add_filter('somdn_get_user_custom_limits', function($limits, $user_id, $product_id) {
if ($product_id == 123) {
// Special limit for product 123
return array(
'type' => 'user',
'amount' => 1,
'freq' => 'Day',
'products' => array(123)
);
}
return $limits;
}, 10, 3);

Displaying Limits to Users​

Account Page​

Users see their limits on account page:

  1. Go to My Account > Downloads
  2. View "Download Limits" section
  3. See current usage and remaining downloads

Shortcode​

Display limits anywhere with shortcode:

[download_limits]

Shows:

  • Current downloads this period
  • Total allowance
  • Remaining downloads
  • Reset date

Custom Display​

Use code to show limits:

$limits = somdn_get_user_limits($user_id);
$count = somdn_get_user_download_count($user_id, $limits['freq']);
$remaining = $limits['amount'] - $count;

echo "You have {$remaining} downloads remaining today.";

Limit Reached Behavior​

Error Messages​

When limit is reached, users see:

  • Custom error message
  • Remaining time until reset
  • Upgrade CTA (if configured)

Redirect on Limit​

Redirect users when limit reached:

add_action('template_redirect', function() {
if (isset($_REQUEST['somdn_errors'][0]['download_limit_reached'])) {
wp_redirect(home_url('/upgrade/'));
exit;
}
}, 99);

Email Notifications​

Notify users when limit reached:

add_action('somdn_download_limit_reached', function($user_id, $limits) {
$user = get_user_by('id', $user_id);
wp_mail(
$user->user_email,
'Download Limit Reached',
'You have reached your download limit. Upgrade for more downloads!'
);
}, 10, 2);

Bypassing Limits​

Exclude Specific Users​

Exclude users from limits:

add_filter('somdn_user_limits_excluded', function($excluded, $user_id) {
$excluded_users = array(1, 5, 10); // User IDs
if (in_array($user_id, $excluded_users)) {
return true;
}
return $excluded;
}, 10, 2);

Exclude Specific Products​

Exclude products from limits:

add_filter('somdn_check_product_in_limit', function($in_limit, $product_id, $limits) {
$excluded_products = array(100, 200, 300);
if (in_array($product_id, $excluded_products)) {
return false; // Not subject to limits
}
return $in_limit;
}, 10, 3);

Temporary Limit Increase​

Temporarily increase user's limit:

add_filter('somdn_get_user_custom_limits', function($limits, $user_id) {
// Double limits for user 123
if ($user_id == 123) {
$limits['amount'] = $limits['amount'] * 2;
}
return $limits;
}, 10, 2);

Use Cases​

Freemium Model​

Encourage upgrades:

  • Free Users: 3 downloads per day
  • Paid Members: Unlimited downloads

Resource Management​

Prevent server overload:

  • All Users: 10 downloads per day
  • Prevents excessive bandwidth usage

Content Gating​

Protect premium content:

  • Premium Products: 1 download per week
  • Basic Products: Unlimited

Trial Periods​

Limit trial users:

  • Free Trial: 2 downloads per day
  • Paid Subscription: 20 downloads per day

Abuse Prevention​

Stop problematic users:

  • Normal Users: 10 downloads per day
  • Flagged Users: 1 download per day

Troubleshooting​

Limits Not Enforcing​

If limits aren't working:

  1. ✅ Verify limits are enabled
  2. ✅ Check tracking is enabled (required)
  3. ✅ Verify user is logged in (for User ID limits)
  4. ✅ Clear all caches
  5. ✅ Check for plugin conflicts

Wrong Limit Applied​

If wrong limit is enforced:

  1. ✅ Check limit priority (user > membership > role > global)
  2. ✅ Verify membership is active
  3. ✅ Check user role assignments
  4. ✅ Review custom limit filters
  5. ✅ Test with different user

Limit Not Resetting​

If limit doesn't reset:

  1. ✅ Check frequency setting (Day/Week/Month/Year)
  2. ✅ Verify time zone settings
  3. ✅ Check cron is running
  4. ✅ Clear object cache
  5. ✅ Test with new download

Count Incorrect​

If download count is wrong:

  1. ✅ Verify tracking is working
  2. ✅ Check date range calculation
  3. ✅ Look for duplicate log entries
  4. ✅ Review custom count filters
  5. ✅ Regenerate statistics

Developer Hooks​

Filters​

somdn_user_limits_excluded Exclude users from limits.

add_filter('somdn_user_limits_excluded', function($excluded, $user_id) {
// Your logic
return $excluded;
}, 10, 2);

somdn_get_user_custom_limits Modify user's limits.

add_filter('somdn_get_user_custom_limits', function($limits, $user_id, $product_id) {
// Your logic
return $limits;
}, 10, 3);

somdn_check_product_in_limit Control which products are limited.

add_filter('somdn_check_product_in_limit', function($in_limit, $product_id, $limits) {
// Your logic
return $in_limit;
}, 10, 3);

Actions​

somdn_download_limit_reached Fires when user hits limit.

add_action('somdn_download_limit_reached', function($user_id, $limits) {
// Send notification, log event, etc.
}, 10, 2);

Best Practices​

Setting Limits​

  • Start generous: Begin with higher limits, reduce if needed
  • Monitor usage: Track average downloads per user
  • Test thoroughly: Test with different user types
  • Clear messaging: Explain limits to users

User Experience​

  • Show remaining: Display remaining downloads
  • Explain resets: Tell users when limits reset
  • Offer upgrades: Provide path to unlimited downloads
  • Fair limits: Set reasonable limits for legitimate use

Performance​

  • Use User ID: More accurate than IP address
  • Require login: Enables User ID tracking
  • Cache counts: Cache download counts when possible
  • Optimize queries: Use efficient database queries

Communication​

  • Privacy policy: Document limit tracking
  • Terms of service: Explain limit policies
  • Support docs: Provide limit information
  • Email updates: Notify users of limit changes