I would like to know how to directly delete a particular file or file list from joomla 3.0 backend without it's going to the trash first.

current code is like this:

if ($this->state->get('filter.state') == -2 && $canDo->get('core.delete'))
JToolbarHelper::deleteList('', 'spadonors.delete', 'JTOOLBAR_EMPTY_TRASH');
elseif ($canDo->get('core.edit.state'))

I have removed this following code from above:

$this->state->get('filter.state') == -2

But when I tried to to Empty trash then it give me the following message:

Warning Delete not permitted

Need a help on this issue.

1 Answer 1


The simplest way would require code edits in two places. The first would be to remove the if/else logic and only load the button which handles actually deletion of the record and assigning a more appropriate label like 'Delete':

JToolbarHelper::trash('spadonors.delete', Text::_('COM_MYCOMPONENT_DELETE'));

Next you need to override the delete method in your SpaDonors controller to handle the required logic. The below is untested boiler plate code, but the idea is you override Joomla's core delete functionality and manually process the deletion:

public function delete()
    // Get items to remove from the request and JTable object
    $cid = JFactory::getApplication()->input->get('cid', array(), 'array');

    // Load model, do not use delete method or you'll get same error
    $model = $this->getModel();

    // Load JTable class using model and pass in array of IDs to delete
    $table = $model->getTable();

Hope this helps.

  • thanks for your help. But in my spadonors controller page there is no delete method, so I can't override yours one. So what to do?
    – indy
    Aug 24, 2015 at 22:30
  • That's fine as It shouldn't be there, the method you're overriding is in the super (parent) class. If you add the delete function to your controller it will override the core Joomla method which normally would handle the dungeon and is throwing the error. Aug 25, 2015 at 1:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.