MIGXDB AfterSave snippet to trigger on bulk delete and after CSV import / upload

Hi All

As the subject of this post suggests, i would like my afterSave snippet to trigger when i upload a CSV and when i do a mass delete.

If i edit one item or delete one item then it triggers but anything that revolves around a mass change such as a migxDB import via CSV or a mass delete does not trigger anything.

Anything i can do quickly to resolve this, i am happy to modify the core or the CSVImport Processor in migx to accomplish this. Also would be a good feature to add as another hook if possible.such as “afterImport” or “afterMassEdit”

version 2.8.3 Modx

You can create a custom processor in your own package.
You don’t have to modify the MIGX code.

1 Like

Do i simply follow the same structure in my own package, so my_package>processors>mgr>default>importcsv.php and then modify that accordingly to match what i want it to do.

That worked :slight_smile:

I added the following to the top of my custom importcsv and it now triggers my aftersave i assigned to that config

$config = $modx->migx->customconfigs;
$hooksnippets = $modx->fromJson($modx->getOption('hooksnippets',$config,''));


Its not elegant or fancy but i just needed it to trigger a snippet on any kind of update and the importcsv was not triggering… I will look into the bulkupdate and emptytrash ones too as i probably need it to trigger on those also

1 Like

Depending on what you are doing in your “aftersave” hook snippet, it may also be an option to instead override the save() function in your custom class. (The one that extends xPDOSimpleObject in the “model” folder.)

1 Like

maybe worth a FR on github