Jump to content

PWaddict

Members
  • Content Count

    774
  • Joined

  • Last visited

  • Days Won

    1

PWaddict last won the day on December 7 2018

PWaddict had the most liked content!

Community Reputation

366 Excellent

About PWaddict

  • Rank
    Hero Member

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

2,677 profile views
  1. 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.
  2. No need to use css. Check out my module for hiding pages for non-superusers.
  3. 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; } });
  4. 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.
  5. 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.
  6. 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
  7. It seems that setMaxFiles is actually used for the maxFiles value (Maximum files allowed) under the Details tab of the file/image field.
  8. 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.
  9. Unless maxFiles & setMaxFiles are actually the same? I've read somewhere that setMaxFiles is max allowed files per upload.
  10. 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.
  11. 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
  12. @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.
  13. 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.
  14. 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...
×
×
  • Create New...