Jump to content

PWaddict

Members
  • Posts

    908
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by PWaddict

  1. The reason you don't see the radio buttons is probably because you're hiding them in css or js. So check your code there carefully.
  2. Please share the code you see in the browser source for the form element.
  3. Check your css and js files in case you're hiding the radio buttons there. Can you please share the code you use to render the variations?
  4. The above hook tested on a site that has 2 languages. Maybe you have another hook that interfere. Empty your site/init.php and site/ready.php and try again.
  5. No need to use css. Check out my module for hiding pages for non-superusers.
  6. I tested this and it works: $this->pages->addHookBefore('saveReady', function($event) { $page = $event->arguments[0]; if($page->template != 'mytemplate') return; if($page->mypagefield) { $p = $page->mypagefield; $page->title = $p->title; } });
  7. I'm creating this post to help any Kaspersky Antivirus owners that will experience the following problem if their server supports HTTP/2: Trying to upload multiple images at once in ProcessWire suddenly became a nightmare. I was getting this error multiple times for some of the images: POST https://www.mysite.com/admin/page/edit/?id=10097&InputfieldFileAjax=1 net::ERR_HTTP2_PROTOCOL_ERROR and sometimes these ones too: POST https://www.mysite.com/admin/page/edit/?id=10097&InputfieldFileAjax=1 502 Uncaught SyntaxError: Unexpected token < in JSON at position 0 at JSON.parse (<anonymous>) at Function.parseJSON (JqueryCore.js?v=183:2) at XMLHttpRequest.<anonymous> (InputfieldImage.min.js?v=123-1599567437:1) Few months ago I've installed Kaspersky Security Cloud on my PC and today when I was checking the SSL certificates on my sites and on third-party sites including ProcessWire I noticed it was saying "Issued by: Kaspersky Anti-Virus Personal Root Certificate". I opened Kaspersky Security Cloud and went to Settings > Additional > Network and I selected "Do not scan encrypted connections" under "Encrypted connection scanning". By default the selected option is "Scan encrypted connections upon request from protection components". Problem solved. I can finally upload multiple images at once again and view the original issuers of the website's SSL certificates.
  8. Now, I'm getting more errors besides the one I mention above. You can delete this topic and if I can't figured out the problem I will create a new proper topic with all the details.
  9. Ok something else is going on. On localhost where PHP has max_file_uploads = 20 too (same as live server) I tried to upload 22 images at once and it worked fine. On live server when I tried to upload the same 22 images I got 13 identical errors in chrome console and 13 images stuck at "uploading" forever... Failed to load resource: net::ERR_HTTP2_PROTOCOL_ERROR
  10. It seems that setMaxFiles is actually used for the maxFiles value (Maximum files allowed) under the Details tab of the file/image field.
  11. My php default shared server settings have max_file_uploads = 20 so I would like to limit to 20 in ProcessWire too cause if I upload for example 30 images at once only the 20 will be uploaded. The other 10 will look like they're uploading forever and this is confusing for the editors. So, is it possible to limit it to 20 in ProcessWire or should I increase the number of max_file_uploads? Also, If I increase it wouldn't be bad for the server performance? Like with "setMaxFilesize" you're getting a warning on ProcessWire that you're not allowed for example to upload a file with size more than what you've set in "setMaxFilesize", I wanna do the same thing for the maximum files the editor can upload at once. I wanna let him upload max 20 and when those 20 uploaded he should be able to upload 20 max more and so on.
  12. Unless maxFiles & setMaxFiles are actually the same? I've read somewhere that setMaxFiles is max allowed files per upload.
  13. This just sets field to accept ONLY 20 images. What I'm looking for is let the editor upload 20 images per upload. If he wants to upload 50 images I don't want to let him upload them all at once.
  14. I'm trying to set maximum image files per upload with the following hook: $wire->addHookBefore('InputfieldImage::render', function(HookEvent $event) { $inputfield = $event->object; $inputfield->setMaxFiles(20); }); but when I go to edit a page with Images fields I'm getting the following error: ProcessWire: ProcessPageEdit: Method InputfieldImage::setMaxFiles does not exist or is not callable in this context
  15. @horst Am I using the wrong hook for setMaxFiles? Sorry my mistake. When I try to edit a page with Images field I'm getting the error saying about "method InputfieldImage::setMaxFiles does not exist etc. So this isn't related to your module.
  16. That works great on backend but on frontend I have to change the code on various pages to get the same results. I think I'm gonna do the hidden field method where I only have to change the sort. Thanks for the help.
  17. I've created a checkbox field named "nodate" and I checked it on a page with empty date field. Then on the above hook added the sort like this: sort=-nodate, sort=-date It seems to be working properly. Now I have to make the nodate checkbox field hidden and automatically checked on save when the editor leaves empty the date field...
  18. With the above hook that @kixe posted I can add multiple selectors too. I'm using 1 date field to sort pages by date but if the date is empty I want that page to be sorted on top. What's the proper selector for that???
  19. Thanks for your reply but I don't understand how to sort the pages with empty date field on top...
  20. I would like to sort pages of specific template with a date field. The problem is that the date field might not always be filled by the editor cause he might not know yet what date to set. So, all the pages with a date should be sorted by it and those that have empty dates should sort on top. Setting the date field on the template's "Sort settings for children" sorts pages with empty dates on bottom.
  21. Try this in your site/ready.php: // if hook "added" isn't working try "save" $this->pages->addHookAfter('added', function($event) { $page = $event->arguments[0]; if($page->template != 'your-child-template') return; $page->setAndSave('title', 'Your Title'); });
  22. I'm trying to set maximum image files per upload with the following hook: $wire->addHookBefore('InputfieldImage::render', function(HookEvent $event) { $inputfield = $event->object; $inputfield->setMaxFiles(20); }); but when I go to edit a page with Images or CroppableImage3 fields I'm getting the following error: ProcessWire: ProcessPageEdit: Method InputfieldCroppableImage3::setMaxFiles does not exist or is not callable in this context
  23. This works properly: $this->pages->addHookAfter('save', function($event) { $page = $event->arguments[0]; if($page->template != 'mytemplate') return; if($page->venue && $page->city && $page->country && $page->date) { $page->setAndSave('title', $page->venue . ", " . $page->city . ", " . $page->country->title . ", " . $page->getFormatted("date")); } else { $page->setAndSave('title', 'Untitled'); } });
×
×
  • Create New...