|
/ Documentation /Developer Hooks & Events/ suredonation_export_one_time_only Filter Hook

suredonation_export_one_time_only Filter Hook

Overview

The suredonation_export_one_time_only filter controls whether the SureDonation donation export includes only one-time donations or also includes recurring donations and renewal records.

By default, the filter returns true, which keeps the export limited to one-time donations.

Use this filter when you need to include subscription-related donation records in the CSV export.

When to Use This Filter

Use this filter when you need to:

  • Export recurring donations.
  • Include subscription renewal records.
  • Export all donation records instead of only one-time donations.
  • Customize the type of donation rows included in the export.

Filter Signature

apply_filters( 'suredonation_export_one_time_only', true );

Parameters

ParameterTypeDescription
$one_time_onlyboolDetermines whether the export is restricted to one-time donations.

Default Value

true

When the value is true, SureDonation restricts the export to donations that are not associated with a subscription.

Return Value

Return a boolean value:

  • true to export only one-time donations.
  • false to include recurring donations and renewal records.

return false;

This allows subscription-related rows to be included in the export.

Basic Usage

add_filter( 'suredonation_export_one_time_only', 'your_custom_function', 10, 1);

function your_custom_function( $one_time_only ) {

// Modify the export behavior.

return $one_time_only;

}

Example: Export Recurring Donations

To include recurring donations and renewal records in the CSV export:

add_filter( 'suredonation_export_one_time_only', 'mysite_export_everything', 10, 1 );

function mysite_export_everything( $one_time_only ) {

// Include recurring donations and renewals.

return false;

}

With this configuration, the export is no longer restricted to one-time donations.

Default Export Behavior

By default: $one_time_only = true;

SureDonation adds conditions to the export query so that donations with subscription relationships are excluded.

Conceptually, the export includes records where:

subscription_id = ”

AND

parent_subscription_id = 0

This prevents recurring donations and their renewal records from appearing in the default Free export.

Including Subscription Records

When the filter returns: false

SureDonation removes the one-time-only restriction.

The export can then include:

  • One-time donations
  • Subscription donations
  • Recurring donations
  • Renewal records

Other export filters continue to apply, including:

  • Donation status
  • Campaign
  • Payment mode
  • Payment gateway
  • created_at date range

Export Columns

This filter changes which rows are exported, not the CSV column structure.

The CSV columns remain fixed.

When recurring donations are included, subscription-related values appear in their corresponding existing columns.

Interaction With SureDonation Pro

SureDonation Pro already changes this behavior by returning false when it is active.

Therefore, a custom callback is generally only needed on a Free-only installation where you intentionally want recurring donation records included in the export.

This filter is applied in:

Donations::build_export_where()

The method builds the WHERE clause used by the donation export query.

Returning false does not modify other export filters or the CSV structure. It only removes the restriction that limits the export to one-time donations.

Related Hooks

  • Suredonation_export_campaigns_limit: Controls the maximum number of campaigns included in an export.
  • suredonation_export_secret_option_keys: Protects sensitive settings from being included in exports.
  • Suredonation_import_donation_row: Filters donation data before it is inserted during CSV import.
Was this doc helpful?
What went wrong?

We don't respond to the article feedback, we use it to improve our support content.

Need help? Contact Support
Table of Contents
Scroll to Top