Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/10/2023 in all areas

  1. Hello all, Sharing some issues that I've had with Dreamhost that I've seen over the last week for ProcessWire sites. This doesn't seem to be caused by ProcessWire itself or it's code. Wanted to let others know in case anyone has sites currently hosted with them. I have several sites on a VPS through Dreamhost (both PW and non-PW). I've been overall happy and have had very few problems over the ~10 years I've used them. Their support team has been great and they are currently working on the issues. Recently it appears that some server config changes made by their admins broke image uploads within ProcessWire. Uploads fail with the UI continually showing the upload spin animation over the image. I initially contacted support regarding one of my client's sites after they told me they were having issues. I then tested this on a different ProcessWire site hosted on the same VPS to check that this wasn't a code issue specific to that one site and it appears that this may affect multiple ProcessWire sites (maybe just on my VPS, not sure yet). The server would return HTTP 418 (cute) and the upload would fail. All other functionality appears to be unaffected. After testing the second site I thought to throw it out here on the forums to see if anyone else hosts PW sites on Dreamhost and have been experiencing this, or give a heads up to people who may want to check on their sites.
    2 points
  2. @LMD I think maybe this is what you want? This is saying to match template=repeater_gallery on the first argument to the method: $wire->addHook('Pages::saveReady(template=repeater_gallery)', function($event) { $page = $event->arguments(0); $event->message("Saving page with template=$page->template"); });
    2 points
  3. Only solution I can think of right now would be handling cookie check server-side, which in most cases is honestly waste of time and resources. My solution is to leave noscript versions out, and use JS similar to what PrivacyWire (and probably all other sensible tools) do: by default the script is disabled (e.g. has type="text/plain" or something along those lines) and only after consent has been given that gets swapped with actual type.
    2 points
  4. Of Just use the newest PW DEV Version ?
    2 points
  5. The new dev branch version 3.0.222 contains about 20 commits and 16 issue resolutions. In terms of new features, last week I mentioned some upgrades to WireHttp, and below are this week's additions: Multi-language month and day names The WireDateTime class (aka the $datetime API variable) has been updated to support multi-language month and day names. Now all month and days are translatable in the WireDateTime file (/wire/core/WireDateTime.php). So if you request any date in a format that uses month names or abbreviations, or day names or abbreviations, they now support multi-language, whether you requested it from the wireDate() function or the $datetime API variable. ProcessWire has long supported multi-language month and day names when using a PHP version prior to 8.1 and you've requested a strftime date format that uses them. But PHP 8.1 dropped the multi-language supporting strftime() function, without leaving a suitable replacement. PHP's IntlDateFormatter can't be relied upon since it's not always compiled with PHP. But as of PW 3.0.222, now we have a suitable replacement. Though it does require you to translate the 7 days and 12 months for file /wire/core/WireDateTime.php using ProcessWire's language translation tool. Note that unlike the previous strftime() solution, the new solution no longer requires you to use strftime() format codes and you can instead use regular date formats and they will be translated automatically. New conditional hooks that match by argument type Another new addition this week is support for conditional hooks that match by argument type. I think this is especially useful combined with ProcessWire's custom page class support. It enables you to make a hook apply only to methods containing arguments of a specific type. For instance, if you had a custom page class "ProductPage" for template "product" and you wanted to capture the "Pages::saved" event for pages of that type (ProductPage) you could do so like this: $wire->addHook('Pages::saved(<ProductPage>)', function($event) { $product = $event->arguments(0); /** @var ProductPage $product */ $event->message("ProductPage '$product->title' has been saved"); }); In addition to supporting class or interface names, you can also specify regular PHP types such as <array>, <string>, <int>, <object>, etc. For more details on this type of hook see the new Conditional hooks that match argument type section of the Hooks documentation. Thanks for reading and have a great weekend!
    2 points
  6. The simplest, quickest, and maybe most useful module I've ever built ? TextformatterJsonDecode: Passes the given text through json_decode(), returning the value (if valid) as a stdClass object. Didn't even bother with a README - does what it says on the tin. Ha need one for the modules repo... This is particularly useful if you are storing JSON from an API in a Page field and want to access it in a similar way to normal Page objects e.g. <?php /* The data { "fieldName": "value" } */ echo $page->api_data->fieldName; // value I'll be using this extensively over the next few weeks, looking forward to it ?
    1 point
  7. The End Session button should still be a thing. Basically it will kill the user switcher session and leave you logged in as the currently selected user with no option to change. As for a back to xxxx user, I am with Robin - there should really be no need for that, especially if you limit the available users via one of these settings. This lets you remove frontend only users etc from the list making it much more manageable to find your own superuser account to switch back to.
    1 point
  8. @bernhard, I think your Tracy Debugger might not be up to date. There is no "End Session" button in recent versions. You just can just click any user in the list and immediately change to that user. So it's pretty quick to toggle between two users - remember you can use the "Find user..." filter to find a user by name. The "Logout to Guest" lets you temporarily switch so you can view the front-end as a guest would, but with the debug bar still available even on production. But if you are using ProCache you would need to switch it off before using "Logout to Guest" because otherwise PHP will be bypassed altogether if a cache file exists.
    1 point
  9. 1 point
  10. You might like this module: https://processwire.com/modules/admin-help/
    1 point
  11. Something like RuntimeMarkup? Or do you want to show it when editing the template, not when editing page?
    1 point
  12. It's expected behavior as the selector in a conditional hook is applied to the event's object, which in this case is $pages, not the page that is about to be saved. You can convince PW to match the selector against the hook's arguments by stating the argument's number in front of the selector (there's an example in the docs towards the end of the conditional hooks section). In your case for the first argument, which contains the page: // match selector against $event->arguments(0) instead of $event->object: $this->addHookAfter('Pages(0:template=repeater_gallery)::saveReady', $this, 'myHook');
    1 point
  13. Hey @kongondo thx. Not sure what you mean exactly. I already have a working solution. The key is to create the SSE stream before the session is started: https://github.com/baumrock/RockFrontend/blob/7ea19d668c5a2acc74777374b51535d42aa56381/RockFrontend.module.php#L121 That way the script from the SSE endpoint does not block the server for regular requests of the user. I agree that it sounds similar but I think it's two different things and it's good to have two different solutions for it ?
    1 point
  14. I was in New Orleans at the gymnastics Nationals most of this week. In her age group and level, my 10-year old daughter won 4th overall and 3rd on bars and beam. After a long drive, we're now back home in Atlanta and it's been a very short work week, but there's still a new dev branch version to write about. ProcessWire 3.0.221 continues primarily with minor issue fixes, working towards our next main/master version. Included are 11 resolved issues, 2 PRs, and code contributions from @matjazp and @dotnetic. In terms of new features, this version updates the language translating _n() function to support languages that consider 0 quantities as singular rather than plural in calls like _n('%d item', '%d items', $quantity); Previously this call has always used the plural "items" version for 0 quantities (i.e. "0 items"), which is correct in English, but may not be in other languages like French (as I've learned from issue #1757, though I think it has come up once before too). To define whether a language should consider 0 quantities plural or singular, use ProcessWire's language translation tool: Setup > Languages > [any language] > Find files to translate > wire/modules/LanguageSupport/LanguageTranslator.php ... when translating that file, you'll see the setting at the top labeled "Is zero (0) plural or singular?": That screenshot above also shows another new feature that was added, which is the ability to use Select and Radios fields when defining translatable text. Previously you could only use text, textarea and number fields. Let's say you wanted to have the person translating choose a color name for the language as part of the translation: $color = __('Red'); // What color? type=radios options=[Red, Green, Blue] As before, the "What color?" part is an optional description for the translatable text. Also as before, the "type=..." defines what Inputfield type to use. The supported values are any Inputfield name (minus the "Inputfield" part). Known to work values for this include: text, textarea, integer, float, radios and select. The "options=[...]" is the newly added part, and this enables you to define the selectable options for select or radios inputs. If you wanted to use separate value and label, you can also do that. In the example below, city abbreviations are used for the values and full city names as the labels: $city = __('ATL'); // What city? type=radios options=[ATL:Atlanta, CHI=Chicago, NYC:New York City] Another example is the one we used in the core for plural vs. singular here. By the way, if any of your values or labels need a literal comma, you can optionally use a pipe "|" as the separator rather than a comma. This ability to use Select and Radios is a fairly minor addition, but does open up better support for having certain language settings (rather than just translatable text) be part of language translation packs going forward. The plural vs singular setting for 0 seemed like a good first one to support with this. Next week we'll continue preparing our next main/master version. Thanks for reading and have a great weekend!
    1 point
  15. Also note that strftime has been deprecated in PHP 8.1. Here’s a topic with alternatives:
    1 point
  16. There’s also this really good tutorial on how to achieve a customizable cookie notice with plain JavaScript using the dialog element: https://www.thomasvantuycom.com/writing/simpler-cookie-notices/
    1 point
  17. Thanks for this @Robin S. Maybe this technique can be used to achieve a non-blocking SSE? @bernhard, what do you think? I haven't thought it through; just wondering ATM. For reference:
    1 point
  18. Hello everybody ? and thanks for your patience! Finally ended my sabbath and updated the module with pull requests and fix for the apostrophe thingy. Also added missing PW namespace + Composer support. There you go!
    1 point
  19. Gratulation on the success of your daughter and thank you for the update.
    1 point
  20. This week, work continued on our next main/master version with 8 issue fixes (see dev branch commit log). In addition, the WireHttp class was updated with new delete(), patch() and put() methods which correspond to http methods of the same name, These might be used by web services in addition to the more common GET and POST methods. In prior versions of WireHttp, you could still use delete, patch and put methods, but had to use WireHttp::send() with the $method argument set to one of them. Now that there are separate class methods for these http methods, it makes them a little simpler to use and more clear in code. It may be that you never need these methods, or it may also be that you use a web service that uses them extensively. The more web services I work with, the more I come across them, and figured it would be good for WireHttp to have more clear support for them. I know things slow down in the summer, but we haven't had many submissions to the sites directory lately. If you have launched any sites using ProcessWire in the last year or so, and haven't submitted them to our sites directory, please submit your websites to the directory when you can. We really enjoy seeing what what people are building in ProcessWire. Thanks and have a great weekend!
    1 point
  21. Congrats to your daughter and thanks for letting us participate in that!
    1 point
  22. Congrats to your daughter! And looking forward for the next master.
    1 point
×
×
  • Create New...