We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37550 ☆ A M B ☆
    • 711 Posts
    onesmarthost Reply #1, 19 years ago
    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
      http://www.onesmarthost.co.uk
      UK MODX Hosting with love.
      • 22303 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.
        • 37550 ☆ A M B ☆
        • 711 Posts
        onesmarthost Reply #3, 19 years ago
        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 smiley


        global $modx, $table_prefix;
        $table = $modx->getFullTableName("site_templates_config");
        $rows_affected = $modx->db->delete($table, "template_id = " .$id ."");
        return true;
          http://www.onesmarthost.co.uk
          UK MODX Hosting with love.