Jump to content

Can't empty trash or delete indivdual trashed pages


Recommended Posts

Hi all.

I've run into a strange issue and am getting the following error when I try to empty the trash:

Error: Call to a member function hasRole() on a non-object (line 1203 of /var/www/vhosts/web_v4/admin/wire/core/Page.php)

I am also getting this error when I try to edit or delete some of the individual pages in the trash.  I cannot delete any of them, and if I try I sometimes get that error and sometime it bounces back to the page listing but all the pages still remain.

I had a hunt in the forum and I found some references to the above error but in a different context.

The only other detail worth mentioning is that I am on v2.2.12.

My instinct is that there is perhaps pages in the trash for which the relevant template/fields no longer exist and this is causing some sort of confusion.

Any suggestions welcomed. I am trying to delete old unused templates but I can't because (I think) pages in the trash are still using them!


Link to comment
Share on other sites

Edit the line that it's talking about in Page.php and change it from this:

if(!$template->hasRole('guest')) return false;

to this:

if(!$template || !$template->hasRole('guest')) return false;

This change is also already present on the dev branch (I ran into the same error a few weeks ago). 

  • Like 2
Link to comment
Share on other sites

  • 3 weeks later...
  • 3 months later...
  • 3 years later...


I have another error when trying to empty trash:

Error: Call to a member function path() on a non-object (line 948 of my/website/directories/here/site/modules/ProDrafts/ProDrafts.module) 

Thats it ... can anyone help?


So I found the solution! For some reason it is impossible to empty trash if there are pages that are Draft's (have a paperclip next to the page name). Just Publish the pages so that the paperclip is no more and then You can empty trash without a problem!



Edited by Slav
Found answer!
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...