Jump to content

Search the Community

Showing results for tags 'trash'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 13 results

  1. I'm trying to delete a page from the API in a front-end template and processwire refuses. I've never had this happen before. I can delete the pages fine from the backend. Here is my very simple code: if($input->post->delete == 'delete'){ $registration = $page->parent->url; bd($page->status(),"Check page status"); //This equals 1 $page->trash(); $session->redirect($registration); } This error comes up: A search on the forum turns up only one other topic in which the user discovered they had a typo that was causing the issue. I also looked at page status and template options mentioned in that post, but they do not appear to be the problem. Beating my head against this one for a couple days...any ideas?
  2. Hi all, I use version 3.0.62. Is there a way to delete all children of a page with one click - without parent page? thanks
  3. So I went to revisit a project that I put on hold and was met with the following error when trying to trash a page "Operator '&' is not supported for 'status' in ../wire/core/PageFinder.php: 2211 else if(!$database->isOperator($operator)) { throw new PageFinderSyntaxException("Operator '$operator' is not supported for '$field'."); } I have searched through my templates just to make sure I didn't do anything screwy, but I have no clue why this error is being generated. I can individually delete an item from the trash, but I cant empty the entire trash.
  4. Hello! The only hook into 'trash' in a module runs twice, by itself, as it seems. The following code outputs: Session: Hooked 1 times on abcd Session: Hooked 2 times on abcd on the admin side when one page is deleted from it's delete tab. And it's no matter 'addHookBefore', 'addHookaAfter' or 'addHook' method is used. Why?! private $i = 0; public function init() { $this->pages->addHookBefore('trash', $this, 'test'); } public function test($event) { $page = $event->arguments('page'); $this->i++; $this->message("Hooked {$this->i} times on {$page->title}"); }
  5. Hello everybody, I am trying to empty the Trash through the API. What's the best way to accomplish that? Also, does $pages->get("parent=/trash/"); work?
  6. Hola, soy bastante nueva en esto. Tengo en la papelera de mi CMS 4300 aprox. archivos que no puedo borrar. Cuando le doy la opción vaciar me dice que no se puede y continuan ahi.
  7. Hello, I have a feeling I'm missing an easy thing here (again...). If I trash a page from API with : mypage->trash() Is there a simple way to restore it if needed ? I can do it in back-end, but I'd like to do it through API with something like mypage->restore() but this doesn't exit So if you can give me a little help on that, I'd appreciate. Thanks in advance !
  8. PageListTrash Allows non-superusers to trash pages directly from Page List (if they have page-delete permission for that page). Not much to say really - the module adds a "Trash" option to the extra actions for pages in Page List. It looks and works just like the Trash action available to superusers. https://github.com/Toutouwai/PageListTrash/ Up to you whether you think non-superusers should be trusted with simpler trashing. For most cases I like the default behaviour where editors have to jump through some more hoops - I want them to think carefully about what they are doing. But if an editor needs to trash several pages then this module might reduce frustration. @tpr, by now you can probably predict what I'm going to say... ...something to merge into AdminOnSteroids?
  9. Hi, I've noticed when I trash pages from a PageTable field, then restore them, they are restored to their original location, however the connection is broken with the PageTable field. Is this expected behaviour? Is there a way for it to maintain this relationship? Otherwise restoring it doesn't actually restore it to it's previous state. Note that in this case the parent pages for the PageTable field is not set as the direct parent.
  10. When I delete a page name, e.g, /cart/, using the admin interface it goes into trash and gets the name /trash/2573.1.11_cart/ . I see that, with the Pages::trashed hook that the previous page name (previousPage) can be accessed. Where can I more information about what happens when a page is put into trash and what the name means?
  11. Hello everyone! I'm not sure the right thread is chosen, but anyway I'll continue. My pages structure looks like Category->Subcategories->Pages A task is to make PW to count Pages,when their amount is changed and write it to the Subcategory's and Category's appropriate field regardless of Pages amount change is made from admin of template. So I'm trying to hook into 'save', 'trash', 'restore' and 'delete' methods from within a site module. 'Save' hook seems to work fine, but hooking into 'trash' requires to track Page->parent and Page->parent->parent the the other way, because they are changed to 'Trash' and 'Root' when 'trash' execution is is finished. The other words, at the moment when I have to count Pages in Category and Subcategory, where the Page was 'thrashed' from, there is already no way to determine, what the Category and Subcategory contained this Page. I'm trying to hook into 'trash' before execution, find Page Category and Subcategory and assign them to an module object property, so after the 'trash' execution I can hook into it again and count Pages in Category and Subcategory, saved in properties. But something causes my before 'trash' hook to execute two times: before and after 'trash', and as the result module object properties contain not Category and Subcategory, but 'Trash' and 'Root' pages. Here is my Code: public $country; public $region; /** * Initialize the module * */ public function init() { $this->pages->addHookBefore('trash', $this, 'prepareTripSave'); $this->pages->addHookAfter('trashed', $this, 'afterTrash'); } /** * Counts 'Trips' in 'Region' and 'Country' * */ public function countTrips($event) { $page = $event->arguments('page'); if ($page->template == 'Trip') { // do only when 'Country' and 'Region' are find if(count($this->country) && count($this->region)) { $this->message('ok'); $amount = $this->region->children("template=Trip")->count(); //count 'Trips' in 'Region' $this->region->setOutputFormatting(false); $this->region->amount = $amount; $this->region->save("amount"); // save only field $this->region->setOutputFormatting(true); $amount = $this->country->find("template=Trip")->count(); //count 'Trips' in 'Country' $this->country->setOutputFormatting(false); $this->country->amount = $amount; $this->country->save("amount"); // save only field $this->country->setOutputFormatting(true); } else { $this->message('nop'); } $this->message("Country: {$this->region->amount}; Region: {$this->country->amount}"); $this->region = ''; $this->country = ''; } } public function prepareTripSave($event) { $page = $event->arguments('page'); if ($page->template == 'Trip') { $this->region = $this->pages->get($page->parentID); // find 'Region' by 'Trip'->parentID $this->country = $this->region->parent; // find 'Country' as a 'Region'->parent $this->message("Before Region: {$this->region->title}; Country: {$this->country->title}"); } } public function afterTrash($event) { $page = $event->arguments('page'); if ($page->template == 'Trip') { $this->message("After Region: {$this->region->title}; Country: {$this->country->title}"); } } Thanks!
  12. I have a simple module that creates a page when another page is saved with a checkbox field checked. My code below works well but I have one issue, it runs when the page is trashed as well as saved (creating an erroneous second duplication of the page). <? public function init() { $this->pages->addHookAfter('save', $this, 'dupeStandalone'); } public function dupeStandalone($event) { $page = $event->arguments[0]; if($page->template->name == "article_language" && $page->article_standalone == 1) { $a = new Page(); $a->template = 'article_standalone'; $a->parent = wire('pages')->get('/article/'); $a->name = $page->name; $a->title = "{$page->title} (standalone placeholder post for {$page->parent->parent->title}-only article)"; $a->save(); } } Could anyone help as to why it runs the function on trash as well as save?
  13. Just testing process wire 2.3 I moved a few recently created pages, yet I can't empty the trash. I get this error, telling me that this SQL table is missing: field_fieldset_meta_end' doesn't exist I can see the table on phpMyAdmin. Thanks in advance.
×
×
  • Create New...