Automattic\WooCommerce\Admin
ReportExporter::email_report_download_link
Process a report export email action.
Метод класса: ReportExporter{}
Хуков нет.
Возвращает
void. Ничего (null).
Использование
$result = ReportExporter::email_report_download_link( $user_id, $export_id, $report_type, $report_args );
- $user_id(int) (обязательный)
- User ID that requested the email.
- $export_id(строка) (обязательный)
- Unique ID for report (timestamp expected).
- $report_type(строка) (обязательный)
- Report type. E.g.
'customers'. - $report_args(массив)
- Report parameters the export was queued with. Exports queued before WooCommerce 11.2.0 run without them.
По умолчанию:array()
Код ReportExporter::email_report_download_link() ReportExporter::email report download link WC 11.3.0
public static function email_report_download_link( $user_id, $export_id, $report_type, $report_args = array() ) {
if ( 100 !== self::get_export_percentage_complete( $report_type, $export_id ) ) {
wc_get_logger()->warning(
sprintf( 'Not emailing the %1$s report export %2$s: it never reported itself complete.', $report_type, $export_id ),
array( 'source' => 'report-csv-exporter' )
);
return;
}
$download_url = self::get_download_url( $report_type, $export_id, $report_args );
\WC_Emails::instance();
$email = new ReportCSVEmail();
$email->set_report_date_range( self::get_export_date_range_label( $report_args ) );
$email->trigger( $user_id, $report_type, $download_url );
}