I've recently upgraded my joomla site to 3.9.1, and now my custom components publish/unpublish buttons aren't working and I can't figure out why. The database column is called "state" and this is the code which was working up until the upgrade:

JToolbarHelper::publish('items.publish', 'JTOOLBAR_PUBLISH', true);
JToolbarHelper::unpublish('items.unpublish', 'JTOOLBAR_UNPUBLISH', true);

These buttons used to work and they would publish / unpublish the items, now I get this message:

0 items successfully published

I'm not sure where exactly the code is which tells it to update the status of the item, but for some reason it's not working anymore.


Inside your table's constructor use setColumnAlias() to define the actual column name:

public function __construct($db)
    parent::__construct('#__example', 'id', $db);

    $this->setColumnAlias('published', 'state');
  • Thank you, I'm getting this error now: Error: 0 Call to undefined method EmploymentModelitems::setColumnAlias() – Leanne Seawright Dec 6 '18 at 6:30
  • 1
    You seem to have added this to the model, not to the table class. Tables are typically found in administrator/components/com_example/tables directory. – Sharky Dec 6 '18 at 6:32
  • lol I had indeed, thank you for your help, that worked!! – Leanne Seawright Dec 6 '18 at 6:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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