-
☆ A M B ☆
- 711 Posts
Hi,
I’m currently trying to extend the MODx template system by storing extra info about templates in another table to include thumbnails plus other bits.
I’ve managed to create a plugin which inserts the data into the new database table upon template save but I’m having problems trying to get the template ID upon delete.
Ive tried it under this function: OnTempFormDelete
but I’m not sure how i can retreive the template ID for my sql delete query?
Any help appreciated.
Thanks
-
MODX Staff
- 10,725 Posts
The variable $id should be available from the plugin when that event is invoked, indicating the id of the document to be deleted.
-
☆ A M B ☆
- 711 Posts
Cheers OpenGeek your right $ID works perfectly the problem was due to my SQL Delete syntax and me trying to pass an array.
This works though
global $modx, $table_prefix;
$table = $modx->getFullTableName("site_templates_config");
$rows_affected = $modx->db->delete($table, "template_id = " .$id ."");
return true;