1 minute reading time (124 words)

Programatically delete Zoo items

Programatically-delete-Zoo-items

While developing a custom frontend for Authors to manage their own content, we needed to let them delete their own items. The Quick & Dirty way of doing this is by executing some delete queries on zoo related tables. But that's not the right & elegant way to do it.

The right way is to use the Zoo API & do this in 3-4 lines of code against 20-30 lines of the dirty code.

$Zoo_Item_Id = 29029; // Zoo Item id which you want to remove.
$app = App::getInstance('zoo'); // Define Zoo app instance.
$item = $app->table->item->get($Zoo_Item_Id); // Get the info of $Zoo_Item_Id
$app->table->item->delete($item); // Removes the $Zoo_Item_Id record from all respective zoo tables.

Just follow the above-commented code & you should be done!

3
Using Joomla logging to easily debug MySQL issues
Join us for a Webinar about SocialAds @CloudAccess...

Related Posts