The Techjoomla Blog

Stay updated with all the latest happenings at Techjoomla. From news about the developments in your favourite extensions to Tips & Tricks about the Joomla CMS, Framework & Development.
Font size: +
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
×
Stay Informed

When you subscribe to the blog, we will send you an e-mail when there are new updates on the site so you wouldn't miss them.

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

Related Posts

 

Blog Topics