Ajax::ajaxDownloadReport()
Output the export content to header buffer
Description
Source
File: bp-integrations/learndash/buddypress/Ajax.php
public function ajaxDownloadReport() { $hash = bp_ld_sync()->getRequest('hash'); $exports = get_transient($hash); $info = get_transient("{$hash}_info"); if (! $hash || ! $exports) { wp_die(__('Session has expired, please refresh and try again.', 'buddyboss')); } $file = fopen('php://output', 'w'); fputcsv($file, wp_list_pluck($info['columns'], 'label')); foreach ($exports as $export) { fputcsv($file, $export); } header('Content-Encoding: '. DB_CHARSET); header('Content-type: text/csv; charset='.DB_CHARSET); header('Content-Disposition: attachment; filename='. $info['filename']); header('Pragma: no-cache'); header('Expires: 0'); fclose($df); die(); }
Changelog
Version | Description |
---|---|
BuddyBoss 1.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.