Jump to content

joe_g

Members
  • Posts

    380
  • Joined

  • Last visited

Recent Profile Visitors

6,011 profile views

joe_g's Achievements

Sr. Member

Sr. Member (5/6)

57

Reputation

5

Community Answers

  1. Hello, I get these emails "did this get resolved, please mark the answer as resolved" but ..i cant find the "mark answer as solution" button. does it exist?
  2. Thanks! That sounds great, I'll try that. I think i just graduated to yellow belt in hooks
  3. aha, this code (in admin.php) seems to be the culprit: Leaving this code and saving many times (it will fail to save every 2-5 times) and then eventually the mysql install dies entirely. I think it's the first time I managed to truly crash a PW install. You think I might be doing something verboten in the code below? $pages->addHookAfter('saveReady', function($event) { //the following code borks the database! if($p->template->name == 'event') { $home = wire('pages')->get('/'); if(!$p->onfrontpage) { $home->of(false); $home->home->remove($p); $home->save(); } if($p->enddate>time() && $p->onfrontpage) { if(!$home->home->has($p)) { $home->of(false); $home->home->add($p); wire('pages')->message('Added ' . $p->title . ' to the homepage'); $home->of(false); $home->save(); } $p->of(false); $p->onfrontpage = 0; } } }
  4. aha thank you! In the mean time the server crashed, pdo_mysql disappeared somehow. If i try to make a new PW install i get "PDO (pdo_mysql) is required (for MySQL database)". So I moved the site to a new server and to my surprise the sometimes-not-saving bug is still happening on the new server. It almost feels like i have two unrelated problems. In any case, when saving it looks normal - changes are listed (below) it's just that it doesn't actually save anything. I'll try a site-export-import next, to see if i that can clear some database problems...
  5. Hey there, I run into a strange problem with a live site that's been running okay for quite some time. I installed sury so it runs the latest php always (this was before debian shipped with php 8). So the only thing that could have changed is the php version... I think. Its on php 8.3.13 and PW 3.0.229. Anyway, if i create a page with some text field it saves ..sometimes. On average every second time. I press save and the page reloads, but then sometimes without the latest update. There is nothing in the PW error log, nothing in the apache error log, also no console errors. To make things weirder, I have another test version of the same site running on the same server and that one is working great. So it might actually be that something is up with this particular install... I'm totally stumped. If you got any ideas i'd love to hear them!
  6. Hey solved it like this, a bit more low-tech: Added the $page-id != 0 check And this is FANTASTIC. Having to choose between image upload (with drag and drop) and the flexibility of the repeater matrix have been my #1 annoyance for a decade!! $wire->addHookBefore('Pages::saveReady', function(HookEvent $event) { /** @var Page $page */ $page = $event->arguments(0); if($page->template == 'fragments') { if($page->id != 0) { foreach($page->upload_files_to_matrix as $pagefile) { if($pagefile->ext == 'mp4') { $item = $page->fragments->getNewItem(); $item->save(); $item->setMatrixType('mp4_block'); $item->mp4->add($pagefile->filename); } if($pagefile->ext == 'jpg' || $pagefile->ext == 'jpeg') { $item = $page->fragments->getNewItem(); $item->save(); $item->setMatrixType('image_block'); $item->image->add($pagefile->filename); } $item->save(); } $page->upload_files_to_matrix->removeAll(); } } });
  7. I'm trying this now but running into ..you wouldn't happen to know why this happens?
  8. Hey there, So I'm trying to update a checkbox in the admin depending on a condition (if the current page exist in a PageArray elsewhere). I'm not sure how to navigate the hooks to achieve this. I suppose I'm trying to do "before render, check if this page exist in the PageArray, if yes, set checkbox to checked, otherwise leave unchecked". many thanks!
  9. this still works in 2024 :) (answering my own question from 2013 haha)
  10. Thanks, i sort of imagined that elasticsearch would be the solution. My case is a bit different I've got both misspelled words but also a mix of languages. A word can be very similar in another language but not directly misspelled. Interesting suggestions, nevertheless, thanks!
  11. Hi there, I've got a question I suspect there might not be an easy answer for: Is there a way to do fuzzy search to allow for spelling mistakes? For example, showing results with 1 or 2 characters wrong or missing, or similar? thanks, j
  12. Hello, It is for a page. Not sure I expressed myself clear enough. So if i do a new "author" with new: The resulting author has all languages checked per default, great! : However, if i create an author through a page field: All languages are turned off by default:
×
×
  • Create New...