Jump to content

Robin S

Members
  • Posts

    5,039
  • Joined

  • Days Won

    340

Everything posted by Robin S

  1. Hi rick, I think you need a trailing slash for AJAX URLs in PW. Try "./some-thing/"
  2. Thanks horst. I did some searching and thought it might be useful to compile a list of the issues, which are mostly (or perhaps all) resolved now. Solved: The issue mentioned above where some images were lost when multiple large images were uploaded simultaneously. https://github.com/ryancramerdesign/ProcessWire/issues/1871 https://processwire.com/talk/topic/13522-problem-with-ajax-images-upload-and-sessionhandlerdb/ Solved: Session times recorded incorrectly when MySQL timezone does not match local time. https://github.com/ryancramerdesign/ProcessWire/issues/1838 https://processwire.com/talk/topic/13307-session-handler-database-times-out-by-two-hours/ Solved: Truncated session data when Tracy Debugger installed. https://processwire.com/talk/topic/15784-what-will-trigger-a-csrf-error/ Solvable: Old sessions not deleted on some Ubuntu servers. I have struck this one myself and @horst's suggestion in the post below solved it. https://processwire.com/talk/topic/5796-session-handler-database-do-not-delete-old-sessions/?do=findComment&comment=56596 Fatal error thrown on Windows server using IPv6. https://github.com/ryancramerdesign/ProcessWire/issues/1596 https://processwire.com/talk/topic/12935-issues-moving-from-iis-localhost-machine-into-windows-server-production/ Slow performance with large number of sessions. https://processwire.com/talk/topic/18718-session-handler-db-issue/ But with huge amounts of traffic performance may be affected without SessionHandlerDB installed too. Login problems after website migration. Might be solvable by clearing caches. https://processwire.com/talk/topic/5317-cant-log-in-this-request-was-aborted-because-it-appears-to-be-forged/?do=findComment&comment=142160 https://processwire.com/talk/topic/13781-problems-after-installing-remote-copy-to-local/
  3. Great, that will be really useful on sites with premium (paid) memberships where you want to prevent multiple users being sneaky and sharing a single account. Thanks @kixe and Ryan. I've avoided SessionHandlerDB apart from when I really need it because I've heard of strange issues that have eventually been traced back to this module. Unfortunately I can't remember what those issues were. For regular users of SessionHandlerDB: are there any issues or incompatibilities with other modules to be aware of? Nice! I only wish the announcement had come a couple of weeks earlier. ? I spent some time recently modifying ProcessForgotPassword for just this purpose. Excellent, I have closed an old request relating to this.
  4. I think of the API reference as the official docs rather than the cheatsheet. The cheatsheet hasn't had a comprehensive update for a long time and there are loads of things in the API reference that aren't in the cheatsheet. The loadOptions / joinFields options are covered in the API reference: https://processwire.com/api/ref/pages/find/ loadOptions (array): Optional associative array of options to pass to getById() load options. https://processwire.com/api/ref/pages/get-by-id/ joinFields (array): Autojoin the field names specified in this array, regardless of field settings (requires autojoin=true). (default=empty)
  5. Welcome @Shoekrates, FormBuilder is a Pro module so you can get support from Ryan in the dedicated FormBuilder sub-forum.
  6. In AdminThemeUikit (might be dev branch only at the moment) you can choose from a few colour options for inputfields: But it would be more flexible to use your browser dev tools to inspect the markup in Page Edit, find what class is unique to the inputfield you want to change, then use AdminOnSteroids or AdminCustomFiles to add a custom CSS file to change the background colour.
  7. The module does not support this, but you could edit the module file, adding the following line here: $embedCode = str_replace('youtube.com', 'youtube-nocookie.com', $embedCode); If you later update the module the change would be overwritten and you would have to redo it.
  8. It would pay to think about how it will work if a user has permission to edit a child page but not its parent. Hiding non-editable pages means hiding any branches under those pages.
  9. You can't add a Field object to a form, but rather an Inputfield object. Field::getInputfield() would come in handy here.
  10. It's annoying, right? You could thumbs-up the existing request for a change to this behaviour: https://github.com/processwire/processwire-requests/issues/186 And as a workaround in the meantime try this hook in /site/ready.php: $wire->addHookAfter('ProcessPageListActions::getExtraActions', function(HookEvent $event) { $page = $event->arguments(0); $actions = $event->return; if(isset($actions['copy']['ajax'])) { unset($actions['copy']['ajax']); $actions['copy']['url'] = "{$this->config->urls->admin}page/clone/?id={$page->id}"; } $event->return = $actions; }); If you find it's not working for you then it might be getting called before the equivalent hook inside ProcessPageClone, in which case you could try experimenting with the "priority" option for hooks: https://processwire.com/api/ref/wire/add-hook-after/
  11. There are also specific elements within the $page->render() $options array for prependFile and appendFile, see here. So you can do: foreach($page->children('template=child') as $child) { echo $child->render(['prependFile' => null, 'appendFile' => null]); }
  12. You have to handle the login throttle exception:
  13. Hi @tpr, a feature request: could you add a cache-busting query string (e.g. using filemtime) to the assets added from the "Asset Paths" section of AOS? Thanks!
  14. My regex is rather weak also, but I think this will work... $cc = $modules->get('ServiceCurrencyConversion'); $text = $page->body; $regex = '/\x{20AC}([0-9]+\.?[0-9]+)/u'; $text = preg_replace_callback( $regex, function($matches) use ($cc) { $dollars = number_format($cc->convert('EUR', 'USD', $matches[1]), 0); return "{$matches[0]} (\${$dollars})"; }, $text ); echo $text; Would makes sense to put this into a simple Textformatter module and use it that way. See TextformatterNewlineBR for a basic example to start from.
  15. Hi @bernhard, A bit OT, but in your development of this module have you had the need yet to get the path or URL of the pages you are including in a query? Do you know a way of getting or constructing the page path/URL from the database data without getting Page objects involved? From a quick investigation it looks like PW builds the path/URL with methods in the Page class but I was hoping to avoid having to load Page objects. Any tips?
  16. @Andreas Augustin It's interesting - if you dump/log the $value here directly in InputfieldTextarea::processInput you can see that the method is called for every language. However, you can only actually hook the call for the default language - for the other languages the method must be called in such a way that hooks are not triggered (by calling the method name with the three underscores included). So you'll probably have to get the other language values from $input (either the WireInput argument to the method or via the API $input variable). For example... $wire->addHookBefore('InputfieldTextarea::processInput', function(HookEvent $event) { $inputfield = $event->object; $input = $event->arguments(0); if(!$inputfield->hasField || $inputfield->hasField != 'your_field_name') return; // The value for the default language $default_language_value = $inputfield->value; // The value for French language $french = $this->languages->get('french'); $input_var_name = "{$inputfield->name}__{$french->id}"; $french_value = $input->$input_var_name; // ... });
  17. @BillH, I can't reproduce the issue. For me the module is working as expected for non-superusers. The list of files is generated in the ajaxResponse() method. To debug you could use Tracy Debugger (best option) or $log to check that the method is firing and is returning JSON for files on the page. Edit: if you updated from an earlier version of the module you might need to do a hard refresh in case the browser is caching the old version of plugin.js - not sure if CKEditor itself does any kind of cachebusting and there is no way to do this within the module for CKEditor plugins.
  18. Robin S

    Nexoc Notebooks

    Nice site! One thing: to avoid blurry text in Chrome you could change instances of... transform: translate3d(-50%,-50%,0); ...to... transform: translate(-50%,-50%); ...if you're not actually using 3D space. Before: After:
  19. You'd need to put more of the markup inside the conditional, otherwise it will be output for each iteration of the foreach. But for more nested markup like this it will be easier to make sense of if you first loop over all the service pages and build an associative array to group the services by person, then loop over the array. <?php $services = $pages->find("template=service-a|service-b, sort=parent.name, sort=sort"); // Group the services by person $people = []; foreach($services as $service) { $people[$service->parent->title][] = $service; } // Take a look at $people using Tracy Debugger just to understand what is going on bd($people, 'people'); ?> <?php foreach($people as $name => $services): ?> <div class="user"> <h3><?= $name ?></h3> <ul> <?php foreach($services as $service): ?> <li><?= $service->title ?></li> <?php endforeach; ?> </ul> </div> <?php endforeach; ?>
  20. Could be done, but I think there are probably better solutions already available such as AvbImage and PageImage Manipulator.
  21. I don't normally deal with multi-language so I'm not sure if this is the best way, but it seems to work... public function validateShortlinks($event) { $field = $event->object; // Get specific language value $french = $this->languages->get('french'); $french_value = $field->get('value' . $french->id); // Or loop over all languages foreach($this->languages as $language) { $value = $field->get('value' . $language->id); //... } }
  22. It is neither built-in nor is it a field - it is just a custom property that you are setting to a page object while it is in memory. You can name the property anything you like - it doesn't need to be named "custom_sort". The "custom_sort" is not saved to the database for any page - it only exists while the page is in memory, and it's purpose is simply to provide some property to use the sort() method on. Then once the PageArray is sorted on that property and saved to the Page Reference field the sort is retained as part of the Page Reference field value. If you just give it a go it will probably start to make more sense.
  23. Great, thanks. Enjoy your holiday!
  24. I had a quick look and validating the form is straightforward. After the form input is processed... if(count($form->getErrors())) { // There were some form errors so do not proceed with action } But at this point we are already in executeExecute() because the action of the form is the execute URL segment, and the page headings are different in this method. Maybe it would be better if the action of the options form was options URL segment, and then if successful redirect to execute segment? Not sure, there are probably several different ways to handle it and I'm sure you'll know the best approach.
  25. Hi @adrian, I have a request for an enhancement to this module. I think it would be useful if the options form for an action was validated before executeAction() fires. So the required/requiredIf conditions are evaluated and executeAction() only fires if the form submission is successful. At the moment executeAction() fires even when the required/requiredIf conditions are not met, which means you have to do extra validation inside executeAction() and that can get quite tricky with some requiredIf setups. What do you think?
×
×
  • Create New...