Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by prestoav

  1. Thanks for the great module! Sadly, I'm now seeing error after updating my MAMP install to PHP 8.0.8. See errors below, other versions numbers for this install are: PW 3.0.200 VersionControl 2.4.0 / VersionControl Cleanup 1.0.0 - this error doesn't occur with VersionControl 1.3.5 without the cleanup module. Errors on admin pages: Warning: scandir(db/variations): Failed to open directory: No such file or directory in .../site/modules/VersionControl/VersionControlCleanup.module on line 117 Warning: scandir(): (errno 2): No such file or directory in .../site/modules/VersionControl/VersionControlCleanup.module on line 117 Warning: foreach() argument must be of type array|object, bool given in .../site/modules/VersionControl/VersionControlCleanup.module on line 118 Warning: scandir(db/): Failed to open directory: No such file or directory in .../site/modules/VersionControl/VersionControlCleanup.module on line 124 Warning: scandir(): (errno 2): No such file or directory in .../site/modules/VersionControl/VersionControlCleanup.module on line 124 Warning: Cannot modify header information - headers already sent by (output started at .../index.php:55) in .../wire/core/WireHttp.php on line 1688 Error trace box content: Look out… Fatal Error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, bool given in site/modules/VersionControl/VersionControlCleanup.module:124 #0 site/modules/VersionControl/VersionControlCleanup.module (124): count(false) #1 site/modules/VersionControl/VersionControlCleanup.module (95): VersionControlCleanup->cleanupFiles() #2 wire/core/Wire.php (417): VersionControlCleanup->cleanup(Object(HookEvent)) #3 wire/core/WireHooks.php (1062): Wire->_callMethod('cleanup', Array) #4 wire/core/Wire.php (485): WireHooks->runHooks(Object(LazyCron), 'everyDay', Array) #5 wire/modules/LazyCron.module (198): Wire->__call('everyDay', Array) #6 wire/core/WireHooks.php (1059): LazyCron->afterPageView(Object(HookEvent)) #7 wire/core/Wire.php (485): WireHooks->runHooks(Object(ProcessPageView), 'finished', Array) #8 index.php (56): Wire->__call('finished', Array) #9 {main} thrown (line 124 of site/modules/VersionControl/VersionControlCleanup.module) Seems to refer to this line (124 of the Cleanup module): if (count(scandir($dir)) == 1) wireRmdir($dir, true); Sadly my knowledge / understanding of what's going on ends here but hoping it can be fixed or it is something else in my install.
  2. Hi @Robin S thanks for your input here. You were right, for the admin lister to work for editor logins looking to find unpublished pages the following is needed: 1) The template must have explicit edit access for editors, not access settings inherited from a parent template 2) The template must be specified in the search alongside the 'Status has Unpublished' rule The requirement for explicit access settings seems a little overbearing to me. If a user has inherited access to create and edit pages using a specific template then it seems sensible that those privileges shouldn't be limited by Lister. I think they should be able to find them in Lister without the template having explicit settings for access. From a UX point of view I think the current situation is misleading, especially as searching for hidden pages does work in the same scenario. Thank you again for you input. This has meant a working solution for the client which is the important bit!
  3. For some more info, I've attached a small truth table as to what is possible in the page lister for the editor in question (first Lister filter set to template = template editor can edit). It shows that, although the 'hidden' filter works ok when used independently, setting the page to 'Unpublished' means they don't show when the page is unpublished and this overrides the 'hidden' filter too so that pages that are both hidden and unpublished are not listed, even when the page is set to hidden and the filter is set to show pages that are hidden. Again, any help is really appreciated.
  4. Well actually, it sadly doesn't seem to always work... This method worked on one of my sites but on a sister site (a near identical site actually) it doesn't work for one particular template. It does work on the previous site (same template structure). Looking at the template in question, neither it or its parent have any access control restrictions and the user is free to edit that page and its parent. Anyone have any experience of this or further suggestions? All help appreciated as always!
  5. Hi Adrian, I tried adding his to ready.php bug got this error when logged in as an editor: No templates specified so 'include=hidden' is max allowed include mode Hi Robin, Yes, this does work, thank you.
  6. Hi all, PW 3.0.200 It seems a user with editor permissions can't list unpublished pages (even if they themselves created them) in the lister within the admin > pages > find function. Superusers can see them but editors can't. Having searched the forums I can only see fixes for page select fields using hooks but nothing that would allow a permission for this to be granted. This is quite an issue for a couple of sites I have. For example, a manufacturer who needs to administer a list of their resellers (all have separate pages) that needs to be turned on / off regularly. There are well over 1k reseller pages so the find function is a god-send for this type of thing. Does anyone have a way around this or a way to set this as a permission that can be granted? Is this feature available in ProLister perhaps? If this can't be easily changed maybe this option should be greyed out in the admin page lister for editor type users? All help very gratefully received!
  7. Hi @Guy Incognito, thanks for replying. In the short term it looks like the current client might be moving away from Zoho so we've paused further development for now. However, I know some of our other clients still use Zoho so I may be back in touch at some point if that's ok!
  8. Hi all, Has anyone produced a module for integration with the Zoho CRM? My client uses this in their business and they'd like to automatically send contact form entries (using FromBuilder) to the Zoho account for storage and action as a 'lead'. Zoho does offer email parsing. However, the clients account level doesn't include that ? Any help or information greatly appreciated!
  9. @Robin S Ah ha, nailed it! My bad for not reading that part of the description. Now changed to checkboxes and it's working a charm. Thanks again for your help. Seriously useful!
  10. Hi @Robin S, Many thanks. This has cured the saving error for sure. It doesn't address the full tree being shown when you go to select a page but I'm not sure that's even possible. Again, every day is a school day. I had seen and used the 'page.field' format in selectors before but not the 'page.page' one. I also wasn't aware that '$page' could be substituted with 'page' in these selectors so thanks for that lesson too! G.
  11. Hi @elabx, Thanks so much for showing these examples I'm not great with page hooks yet but I'm getting there. I'm going to look deeper into you examples and have a play!
  12. Hi all, I'm building a categorised FAQ section for a site with the following structure: -FAQ Page (template = faq-parent) -- Category 1 (template = faq-category) -- Category 2 (template = faq-category) etc. -- Questions (template = faq-articles) --- Question 1 (template = faq-article) --- Question 2 (template = faq-article) etc. The 'Questions' page is a container for all the actual question pages (articles) to make admin clearer as there are likely to be 100+ question pages / articles. I'd like to make the system so I can duplicate it elsewhere in the same website as we might have more than one FAQ section using the same templates and page structure. Each article has a page reference field where the editor can choose one or more categories for the article to be listed under. So, to ensure flexibility, I'd like this field to only select from categories that are under the main 'FAQ' page grandparent of the actual article. This would ensure that a second FAQ section would not conflict with the first. Setting up the page reference field for the article category I would usually set parent and template in the 'Selectable Pages' fieldset. However, setting the parent would restrict the flexibility of the system to just this FAQ section (because the parent is pre-set). So, trying to use the 'Selector String' method I added the selector: template=faq-category, parent=$page->parent->parent, sort=sort But I get this error when saving an article page with a chosen category: PagesEditor: Error saving field "Categories this question is displayed in" — Unrecognized operator: $ Also, when selecting the category on the article page, the whole page tree is displayed rather than the sub set of pages found by the selector. Does anyone have any ideas how this might be done or will I need to leave the field selection open for any page? All thoughts gratefully received!
  13. Hi Zeka, Thank you for the suggestion. Sadly that just gives a blank array and the error 'Notice: Array to string conversion'. Stay safe my friend.
  14. Hi all, PW 3.0.184 On trying to diagnose a form issue it's become clear that the PW $session array is empty. $_SESSION has data in it but PW's own $session variable is empty, not even the User ID is there? For example adding this at the top of any page: <?php print_r($session); ?> Results in this: ProcessWire\Session Object () But this: <?php print_r($_SESSION); ?> Outputs user and other data. I'm trying to use some data that woudl be way easier using PW's $session and am drawing a blank. Grateful of any ideas or past experiences which may help diagnose this!
  15. Hi @horst Thanks for your repay. $config->debug is on and no errors there. I've also checked logs and nothing showing up there either sadly ? I've also uninstalled the 'Page Rename Options' module in case that was interrupting the process but that made no difference either. Finally I've updated the client server to PHP 7.4.21 but that didn't change anything.
  16. Hi Andreas, Thanks for the information and glad I'm not alone! I just tried a copy on my local MAMP install (PHP 7.4.21) and that worked just fine. On the client's DV server (PHP 7.3.33) it won't work. I'm not keen to change the client's PHP version yet but I could if it comes to that.
  17. Hi there, PW 3.0.165 I have a multi-language site where I need to change the URL slug / name of the page. Current names are: /en/page-name /fr/page-name /de/page-name etc. ('page-name' is actually something else) I go into the page in admin and change (under settings) to the following: /en/page /fr/page /de/page (again, 'page' is something else but just a single word, no spaces or special chars) But when I save the page and look again all the names are back to: /en/page-name /fr/page-name /de/page-name etc. Is there a template setting or similar I have missed where you can prohibit name changes? I'm not getting any warnings about it and I can't see one but I'm sure I'm missing something! Any help really appreciated!
  18. Hi @Robin S this is super helpful and makes complete sense. I was arriving at that conclusion but your explanation and examples really help. When I have it working I'll post final code here for anyone looking in future.
  19. Hi @Robin S Thanks again for the code above, really useful. I'm getting a lot of this to work now except the actual the actual upload of the file itself. The list of file names generates properly to the $_POST['images'] and is readable and correct if you print_t the $image_names. However, the image isn't uploading and I'm getting this error : Error: Exception: Unable to read: /site/assets/files/21526/img-1.png (in wire/core/Pagefile.php line 230) There is no file uploaded to that directory. Note: 21526 is the page ID, img-1.png is the correct name for the uploaded image. Further down the error text the issue seems to originate from this line: $pageimages->add($pageimage); Here's my full PHP ($pte is the page itself assigned elsewhere and tested as working): // Update Images // Look for the comma separated value in POST $images_value = $_POST['images']; // If the value exists then the form was submitted & we need to update image fields if($images_value != '') { // Explode the comma separated value to an array of image basenames $image_names = explode(',', $images_value); // Add empty images if no image added or removed if (count($image_names) < 4) { $blanks = 4 - count($image_names); while ($blanks > 0) { array_push($image_names, ""); $blanks = $blanks - 1; } } // Create a Pageimages object using the individual image basenames $all_images = new Pageimages($pte); foreach($image_names as $image_name) { $all_images->add($image_name); } // Turn off output formatting because we are about to set field values $pte->of(false); // Loop over the image basenames foreach($image_names as $index => $image_name) { // Get the Pageimage from $all_images $pageimage = $all_images->get($image_name); // Create a new empty Pageimages object $pageimages = new Pageimages($page); // Add the Pageimage if ($pageimage != '') { $pageimages->add($pageimage); // Determine the field name that will be updated if ($index == 0) { $image_field_name = 'page_image'; } else { $image_field_name = 'product_image_' . $index; } // Set the field value $pte->$image_field_name = $pageimages; } } } $pte->save(); You'll see I've added blanks to fill in empty / missing fields as the front end form allows for images to be deleted so I need to populate those with no image if they have been deleted. Also, you'll note that the first image field to upload to has a different name. This is a legacy issue I'm dealing with... Any ideas on why the image isn't being uploaded would be really helpful!
  20. OK, I found the problem. OPCache was enabled in the new version of MAMP Pro. Just turned it off and everything refreshes as it should. Hope that helps someone!
  21. Hi @Laikmosh, I think I have disabled all caching modules in PHP, certainly socache and file_cache_module. In terms of the cache expiry time, I'm not sure to be honest. If you have any ideas where that might be hiding I'd greatly appreciate it!
  22. I wondered if anyone has seen this and maybe has a fix? After editing Page templates are saved but code updates do not update the rendered immediately, even with a hard refresh of the page (shift+refresh). It seems to cache the page for a few mins (3-4) regardless of PW / MAMP cache settings. This applies to rendered HTML, rendered PHP variables and site_debug errors. I'm experiencing the same thing on Google Chrome Firefox. PW 3.0.184 Anyone else seen this and / or found a fix?
  23. Hi @Robin Wow, what a seriously awesome reply thanks so much. I'm going to be implementing this today. Thank you!!
  24. I am re-working an advert editor on a marketplace site and one of the most requested features is to be able to reorder the images that have been uploaded. To do this I need to be able to move existing images between separate page fields (let's call them image_1, image-_, image_3 etc.). The fields are all setup to have only one image each in the field setup. So far I have the functionality sorted to allow advert owners to delete images or upload replacement images for each field if needed and that all works fine. I also have an edit form that tracks the images as they are dragged around in JQuery UI so that, when the edit form is submitted, they post-processing can see the original field the image was in and the intended field that the image needs to move to as a result of the reordering. I'm now stumped as to how to best move the actual files around so they show in the right order, both in the live advert and in the edit form if it's edited again. Has anyone found a good way to do this? The stumbling block is that each field can only tae one file at a time so it feels like I need to move all the files to be moved into a temporary location then move them back into the right, new spots. Any suggestions very much appreciated!
  • Create New...