Skip to content

Instantly share code, notes, and snippets.

@cgi-caesar
Last active July 29, 2019 07:36
Show Gist options
  • Save cgi-caesar/a1c24a2778a637fadd9a02a9574865f5 to your computer and use it in GitHub Desktop.
Save cgi-caesar/a1c24a2778a637fadd9a02a9574865f5 to your computer and use it in GitHub Desktop.
aMember (site.php): Ability to clear invoice log from admin interface
<?php
/**
* Add new item to aMember CP -> Utilities -> Delete Old Records
*/
Am_Di::getInstance()->hook->add(Am_Event::CLEAR_ITEMS, function(Am_Event $e) {
$di = $e->getDi();
$e->addReturn([
'method' => function ($date) use ($di) {
$di->invoiceLogTable->deleteBy([['tm', '<', $date]]);
},
'title' => 'Invoice Log',
'desc' => 'invoice log table (used by admin only)'
], 'invoice_log');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment