benecaster_migration_csv_preview
Filters what the Migration Wizard’s upload step is told about an uploaded export — the response of POST /benecaster-migration-wizard/v1/shows/{show_id}/csv-preview, which also supplies the field-mapping step. Use it to add your own reading of the file: a column your CRM needs, or a warning about a value only you recognise. The payload’s keys are listed on the Migration Wizard REST API page.
The parse is all there is. The uploaded file is read out of PHP’s temporary upload and discarded when the request ends; there is no stored copy to open.
Neutralise anything you add to preview or to a columns heading with \BenecasterMigrationWizard\CsvParser::neutralise_formula(), as the existing values already are. Those values are shown in an admin table and can reach an export the podcaster opens in a spreadsheet, where a cell starting =, +, - or @ runs as a formula. Neutralise on output only.
platform set to null is a decision, not a gap. It sends the podcaster to manual column mapping. Filling it with a guess pre-fills a mapping nobody confirmed, which looks right at a glance and moves an audience onto the wrong tiers. For the same reason, mapping.needsManualMapping is also true whenever platform is null, and overriding it to false is the change most likely to be waved through unread.
Nothing arrives declined. A field the podcaster says is not in their file is their statement to make; leave an unmatched field in mapping.unresolved.
matchedAliases holds normalised column keys (patron since), not the file’s own spelling — look the heading back up in columns before showing it to anyone.
lapsed is { count, column, checked }, and checked: false does not mean nobody has left. It means no status column was found — the platform emits none, this export omits it, or there is no platform profile on the any-CSV path. All three import everybody, so a filter that reads count without checked reports “nobody has lapsed” for a file it never looked at.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$payload |
array |
— | The response: fileName, platform, columns, rowCount, truncated, rowCap, encoding, malformed, duplicates, preview, fields, mapping, distinctValues and lapsed. |
$csv |
\BenecasterMigrationWizard\ParsedCsv |
— | The parsed file. |
Returns:
array
Example
add_filter( 'benecaster_migration_csv_preview', function ( array $payload, \BenecasterMigrationWizard\ParsedCsv $csv ): array {
$payload['has_external_id'] = $csv->has_column( 'Member ID' );
return $payload;
}, 10, 2 );
Need this built rather than just documented? See our services →