Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Last active December 30, 2015 12:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pebblo/976ed35816bd3b9a6d03 to your computer and use it in GitHub Desktop.
Save Pebblo/976ed35816bd3b9a6d03 to your computer and use it in GitHub Desktop.
For large numbers of registrations the export feature needs to be broken down into smaller sections to prevent the server from timing out. This function allows you to set a limit on th query, run the export to download X amount of records, then update the limit and run the export again to get the next 'section' of registrations and so on....
<?php
/*
Plugin Name: EE Site Specific Plugin for EE Export functions
Description: This plugin allows you to set a limit on the query used for the CSV export.
*/
/* Begin Adding Functions Below This Line; Do not include an opening PHP tag as this sample code already includes one! */
add_filter( 'FHEE__EE_Export__report_registration_for_event', 'ee_custom_export_limits', 10, 1 );
function ee_custom_export_limits( $current_query) {
// The query limit is set here.
$current_query['limit'] = array(0,400);
//array({offset}, {limit})
//Offest = the row to start from
//Limit = the amount of rows to pull in, starting from the offset value.
//So to export 1200 registrations you can break this down into:
//array(0,400); (then run the export and save the file)
//array(400, 400); (again run the export and save the file)
//array(800, 400); (run the final export and save the file)
return $current_query;
}
/* Stop Adding Functions */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment