Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/22/2024 in all areas

  1. Ok, I tried to reproduce your situation locally on Docker. There are two languages "default" and "other". I have used site-blank as template and just added a TinyMCE ML field for body and added it to basic-page. Also, I changed the title field to be ML. PW version is 3.0.227 and PHP version is 8.2.18. Here's the result after I have changed nothing and just hit "Save" (same result when I change something): And here is the relevant code I used. I tried to stay as true to your code as possible. ready.php <?php namespace ProcessWire; if(!defined("PROCESSWIRE")) die(); /** @var ProcessWire $wire */ $wire->pages->addHookAfter('Pages::saved(template=basic-page)', 'hookPageSaved', ['priority' => 200]); function hookPageSaved(HookEvent $event) { $wire = $event->wire; $page = $event->arguments(0); // get the saved page // save current settings $saved_lang = $wire->user->language; $saved_user = $wire->user; $saved_output_formatting = $page->of(); // set current user to guest user $wire->users->setCurrentUser($wire->users->getGuestUser()); $page->of(true); $json_data = []; foreach ($wire->languages as $l) { $lang_name = $l->name; // set current language for rendering the page $wire->user->language = $l; // get rendered json data as string $markup = $page->render(); $json_data[$lang_name] = json_decode($markup); } // restore saved settings $page->of($saved_output_formatting); $wire->users->setCurrentUser($saved_user); $wire->user->language = $saved_lang; // write the JSON data to Tracy bd($json_data); } basic-page.php <?php namespace ProcessWire; /** @var Page $page */ $json_data = []; $json_data['headline'] = $page->title; $json_data['text'] = $page->body; header('Content-Type: application/json'); echo json_encode($json_data); Note two differences: I have restricted the hook to only fire for pages with template basic-page (as this would throw a bunch of errors in the Admin otherwise) I am not using a module to add the hook Maybe this sheds some light into the situation.
    2 points
  2. AI help sounds good: Certainly! You can use a hook to modify the output of a Page Reference field when it is set to "Open + Locked (not editable)" by hooking into the `renderValue` method of the `InputfieldPage` class. Here is an example of how you can achieve this in ProcessWire: // Add this to your site/ready.php or a custom module $wire->addHookAfter('InputfieldPage::renderValue', function(HookEvent $event) { $inputfield = $event->object; $page = $inputfield->value; if($page instanceof Page) { // Modify the output to include a link to the referenced page $event->return = "<a href='{$page->url}'>{$page->title}</a>"; } }); This hook will intercept the rendering of the value for `InputfieldPage` fields and modify it to include a link to the referenced page. Make sure to place this code in a file that is executed on every request, such as `site/ready.php` or within a custom module's `init` method. For more information on hooks in ProcessWire, you can refer to the https://processwire.com/docs/modules/hooks/
    2 points
  3. @flydev is implying that just a difference in $debug configuration or the module TracyDebugger being active or not can make some difference in how PW works in cases as peculiar as yours. That's why you need to make sure your environment is actually identical not just with PHP versions and database versions. We've experienced some problems/differences with Tracy messing up the frontend only when it's enabled (not even necessarily showing it's panels). Also that's why I suggested you make a carbon copy of your local install and try to run it somewhere else and look for anything that's changed to rule out it being your code or make sure it actually is your code and not something external and out of your control.
    2 points
  4. Hello, I have updated the 009 release. In summary: Fix for a customers issue that did not play nicely with ProcessWire users. Thanks @alexm. I hope to write a bit about the customers feature later today. Compare price field now only shows an error if there is a non-zero value in it and that value is less than the 'price' field. Thanks @Spinbox. Activated a 'Live Stock Checker' feature I was working on with @Pete. I will create a new thread for this to explain how it works. The Live Stock Checker allows you to check certain specified products stock levels' before allowing them to be added to the basket. It checks both available amounts since last completed order (inventory) and also the quantities currently held in baskets across sessions on your site. ps: Emails now work on the shop. Thanks @alexm Have a nice day!
    2 points
  5. You might already know this, but I just found an easy way to have custom tooltips on inputfields: $field = $this->modules->get('InputfieldSelect'); $field->name = "example"; $field->label = "Cool Tooltip"; $field->attr("uk-tooltip", "title: My tooltip text; pos:left; delay: 200"); // this line $field->addOption("option1", "Option 1"); $field->addOption("option2", "Option 2"); Have a look here for all the options.
    2 points
  6. This week we've bumped the ProcessWire dev branch version to 3.0.239. Relative to the previous version, this includes 15 commits. This version is required if you decide to test out the new PageEditChildren module, which has also been released in the ProFields board today. I'm not sure it'll remain in the ProFields set of modules, as it's not even a field. But after spending multiple days updating ProFields modules to be compatible with it (also posted today), I thought it was best to keep them together for the short term. It's easier for me to support that way at least. Longer term, it may even become a core module. There's also a couple other modules in ProFields right now that I'm planning to move into the modules directory and GitHub. These most likely include TextBlocks, AutoLinks, and potentially FunctionalFields. These modules have not required much in terms of support resources in awhile, so may not need to be part of ProFields any longer. Thanks for reading and have a great weekend!
    1 point
  7. Hi, With the introduction of GDPR regulations, many of our clients with "webuser" systems we've developed need a way to email users that haven't logged-in in a while (18 months seems to be the standard) to ask them if they still want their user account. For most of the systems we've developed, we've added a field to the user template which records the time when the user logs in, so we'll be able to develop this functionality. It got me thinking, would this be a welcome addition to the core, accessed in a similar way to created/modified dates e.g. $user->lastlogin? Were it to be implemented, it would be useful to be able to 'silently login' if using $session->login($username, $pass) or $session->forceLogin($username), in the same way you can bypass save hooks by passing in an option to $pages->save(). Cheers, Chris - NB Communication
    1 point
  8. Following the advice of some PW-forum members @gebeer @dotnetic @bernhard @sebibu, I would like to share my first Processwire module with all members. QuickSave: My first attempt at developing a PW module to quickly save a page. What can the module QuickSave do: Quickly save a page edit in the admin and return to the last activity. Adds an extra save button AND shortcuts CMD+s and CTRL+s. QuickSave includes an additional plugin for TinyMCE. The plugin for TinyMCE must be assigned and activated specifically for these textarea fields. (Keyboard input shortcut does not yet work in an iFrame - RTE/iFrame, CKE, etc.) PW-QuickSave-1024-v16.mp4 Installation: To install the module, it simply needs to be copied into the Processwire module directory and then activated in the Processwire admin. Optional: Anyone who uses TinyMCE can activate the keyboard input shortcuts via the configuration as a plugin for TinyMCE. Afterwards it has to be activated for the field (e.g. body). This is the path for the configuration in TinyMCE: /site/modules/QuickSave/tinymce/quicksavetinymce.js QuickSave-TinyMCE-inst.mp4 I have been using the module only as a save button version for some time in a long Processwire page with a strong content and a four-fold nested repeater matrix and it works. The keyboard shortcuts were added because of a request. I was only able to test these on the Mac and hope they also work with Windows browsers. Due to another request, the short notification after saving was added. I hope you like the module and that it helps the moderators to keep a better eye on the areas they are currently working on. Especially with long pages and, for example, a table with many rows, it is very helpful for me not to lose the row when saving. (see the video) Note: The module does not intervene in the Processwire saving process, only the original saving button function is triggered. Please note that the keyborad shortcodes do not work in iframes or CKEditor. UPDATE: New version 0.1.7 added on April 13, 2024. A new combined version without jQuery has been created. Thanks to @dotnetic and all others ?. It is now more optimized and further optimizations are planned. Module 0.1.7 Download: QuickSave.zip Feedback on whether the keyboard shortcuts ctrl+s work under MS Windows would be great... ? Thanks and Greetings Chris
    1 point
  9. Thank you! and this version has fixed the problem I was having before you updated! My frontendlogin using a latte template was not getting redirected on login, it got stuck with the "please be patient...", but now it works all fine.
    1 point
  10. I have fixed the bug now and bump up the version. Please be patient, in a few minutes, you can download a new version of FrontendForms, which should work. Jürgen
    1 point
  11. When you have a pageReference field and set the visibility to `Open + Locked (not editable)`, only the text that you set (default: title) is shown. But is is also possible to enable a link to this page reference? It would be very helpful if a user can navigate to the pageReference.
    1 point
  12. @MarkEby reproducible example I mean we could reproduce the issue. You could for example just publish/paste your module structure without all the business logic. Without code it’s not easy to help in this case. Without insisting, profiling your setup will speed also the debug process, as you will see instantly when your module is initialized and maybe also spotting where the glitch happen between the dev and prod. Maybe we are also going too far and might be a simple permission issue. Idk.
    1 point
  13. Thanks for the information @bernhard I updated and extended my blog post
    1 point
  14. Also, when you say it isn't working on live environment and everything is identique, does this sentence imply $debug is set to true and tracydebugger is enabled? Just asking as it make the env not the same, and then hooks order is likely not the same. To make things easier, publish or send via pm a reproducible example ?
    1 point
  15. @MarkE in order to get rid of any frustration, I suggest you try to understand the order of execution of pw, as suggested by @BrendonKoz profiling a fresh install, and then adding your module and starting profiling again, and then comparing each runs is your best bet and will make things clearer for you. If you dont have ProfilerPro, just tell us if you are running on windows or linux and I will write you a small tutorial to get a profiler with xhprof, it's easy and take 2 minutes.
    1 point
  16. @heybran you will find the direct access to Duplicator's packages management from menu Setup > Duplicator On server, you can list packages under ls -lah /public_html/site/assets/backups And welcome to the forum ?
    1 point
  17. Same reasons as CMS Critic probably... People don't like spending money on developers these days. You can just install a plugin... That's why the internet is full of Frankenstein websites.
    1 point
×
×
  • Create New...