dhruba Posted September 1, 2013 Share Posted September 1, 2013 Hey when I try to delete repeaters I got n error Call to a member function hasRole() on a non-object My code is $items = $pages->find("template=repeater_items,include=all");// I tried wire('pages') also foreach($items as $item) $item->trash(); ?> Please Help. Link to comment Share on other sites More sharing options...
kongondo Posted September 1, 2013 Share Posted September 1, 2013 Hi dhruba, Please try not to double post, thanks. Link to comment Share on other sites More sharing options...
dhruba Posted September 1, 2013 Author Share Posted September 1, 2013 Hi kongondo I thought this is an important topic those who are new in PW so i posted in different thread. Thanks Link to comment Share on other sites More sharing options...
kongondo Posted September 1, 2013 Share Posted September 1, 2013 Would this be of help? http://processwire.com/talk/topic/3619-updating-repeaters-via-api-without-removeall/ Link to comment Share on other sites More sharing options...
dhruba Posted September 1, 2013 Author Share Posted September 1, 2013 Thanks kongondo But I m not able to solve my problem so I manualy deleted from database. But when I creat new page with repeaters I got two entry in admin--->repeater--->repeter_item one is for mypagetitle and one is for for-page-0 (I don't know from where it comes) and when i delete the page the for-page-0 remains in admin--->repeater--->repeter_item . Link to comment Share on other sites More sharing options...
kongondo Posted September 1, 2013 Share Posted September 1, 2013 I'm not sure, but I don't think you can only delete repeaters using remove() then saving? I could be wrong... Link to comment Share on other sites More sharing options...
Soma Posted September 1, 2013 Share Posted September 1, 2013 Why not wait for Ryan to comment your same question in that other thread? http://processwire.com/talk/topic/2067-repeaterpage-delete-bug-report/ http://processwire.com/talk/topic/3172-orphaned-repeater-data/ http://processwire.com/talk/topic/2304-deleting-pages-with-repeater-fields/ but it's hard to help when the questioner don't respond to question anymore and Ryan couldn't reproduce, and some threads seems hanging because maybe they also created yet another thread. The repeater page you see when creating a new page are the precreated repeaters that are yet not used but ready to add. Link to comment Share on other sites More sharing options...
dhruba Posted September 2, 2013 Author Share Posted September 2, 2013 Quick Fix.................. I m able to solve by commenting on line 1275 in wire/core/page.php public function isPublic() { if($this->status >= Page::statusUnpublished) return false; $template = $this->getAccessTemplate(); //if(!$template->hasRole('guest')) return false; return true; } I think this error for admin templates like repeater_template_name that has no method like hasRole. I hope Ryan can fix this. Link to comment Share on other sites More sharing options...
ryan Posted September 5, 2013 Share Posted September 5, 2013 I'm not sure about exactly what's causing it, except that I ran into it too at one time and fixed it on the dev branch. You can make the same change I did outlined in this thread or you can switch to the dev branch. Hopefully either should fix it. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now