Jump to content

Delete Repeaters


dhruba
 Share

Recommended Posts

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

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

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

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

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
 Share

  • Recently Browsing   0 members

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