Leaderboard
Popular Content
Showing content with the highest reputation on 06/20/2020 in all areas
-
In ProcessWire 3.0.160 we’ve got some major upgrades and additions to our text-matching selectors and operators. This brings a whole new level of power to $pages->find() and similar API calls, especially when it comes to search engine type queries. This blog post also includes a demo search engine that lets you test everything out live— https://processwire.com/blog/posts/pw-3.0.160/6 points
-
There is an alternative method in ProcessWire to determine if $page is editable by current user: https://processwire.com/api/ref/page-permissions/editable/ It returns true or false if the user is allowed to edit the page.6 points
-
Screencast updated - import of an entire article ☝?️ Still dealing with media files.5 points
-
Hi @joer80 In the top of the post.php file, you can write your logic to check which user is allowed to post or not xhr request. Example : <?php namespace ProcessWire; // if the page is viewed wihtout ajax, return if(!$config->ajax) return; // if the user is a superuser, return if($user->isSuperuser()) return; // only editor can post request to this page if(!$user->hasRole('editor')) return; // other checks if needed, CORS check, Custom header check, etc // rest of code - access granted // ... then, for example in your component , but anyway you already know how to do it : // example editPage() { this.$store.dispatch('setEditPage', this.$route.path).then(() => { axios .post(config.apiEditPageURL) .then(response => { this.data = response.data }) .catch(error => { this.errored = error }) .finally(() => { this.$store.dispatch('loading', false) }) }) },5 points
-
Progress update: Have managed to throw in a few hours on v2. The frontend is being rebuilt in Svelte, because I simply don't use jQuery/Datatables anymore. By not using any of these, I'm free to code this thing the way I want, without having to use a bunch of dependencies that are simply frustrating to build things with. Datatables in particular is hell to work with. (As an aside, I primarily work with Vue, but Svelte is a little more suited here. No runtime, much smaller bundle.) Anyways, here's a preview of the redesigned jumplinks list. Newly built styles, consistent in both the default and UIKit themes (should be fine in custom themes too) and scoped to the Svelte container. Have carried over the behaviours, however instead of fetching all jumplinks, they're now fetched as a paginated collection. I'm sure there are a few sites out there with many jumplinks, and fetching them all is just too much. As mentioned in a previous preview post (such a long time ago!), you'll be able to turn off the colour helpers if you don't like/need them.4 points
-
Just check the user role ? https://processwire.com/docs/user-access/roles/ or change the permissions to your post page in the Admin Panel (or both!) https://processwire.com/docs/user-access/permissions/4 points
-
We have created a module to create BlurHash strings for images while uploading in ProcessWire. This blurry images will be saved in the database because they are very small (20-30 characters) and can be used for Data-URL's as placeholders for image-lazy loading. https://github.com/blue-tomato/ImageBlurhash E.g. where we use this in production: https://www.blue-tomato.com/en-INT/blue-world/ https://www.blue-tomato.com/en-INT/blue-world/products/girls-are-awesome/ https://www.blue-tomato.com/en-INT/buyers-guides/skateboard/skateboard-decks/ https://www.blue-tomato.com/en-INT/team/anna-gasser/2 points
-
2 points
-
Could you please elaborate what you mean by "can't make it work"? Also the statement "seems like it's great for visualising results" shows that you may have misunderstood what it is or does, because it is really not for visualising data but for FINDING data ? It does exactly what you state you need: Finding data and returning a plain array in a performant way. Visualization can then be done however you want. RockTabulator is a little cumbersome, but tabulator.info is great and you can easily build a custom integration that renders thousands of rows. You don't even have to use RockFinder as data source, you can also use a custom ajax endpoint to get junks of data: http://tabulator.info/docs/4.6/data#ajax-progressive Many options, but I'd really be interested in the part "can't make RockFinder3 work" ?2 points
-
This is a great concept, thanks for creating a module for it - have to try that soon! ?2 points
-
Cacheable Placeholders This module allows you to have pieces of dynamic content inside cached output. This aims to solve the common problem of having a mostly cacheable site, but with pieces of dynamic output here and there. Consider this simple example, where you want to output a custom greeting to the current user: <h1>Good morning, <?= ucfirst($user->name) ?></h1> This snippet means you can't use the template cache (at least for logged-in users), because each user has a different name. Even if 99% of your output is static, you can only cache the pieces that you know won't include this personal greeting. A more common example would be CSRF tokens for HTML forms - those need to be unique by definition, so you can't cache the form wholesale. This module solves this problem by introducing cacheable placeholders - small placeholder tokens that get replaced during every request. The replacement is done inside a Page::render hook so it runs during every request, even if the response is served from the template cache. So you can use something like this: <h1>Good morning, {{{greeting}}}</h1> Replacement tokens are defined with a callback function that produces the appropriate output and added to the module through a simple hook: // site/ready.php wire()->addHookAfter('CachePlaceholders::getTokens', function (HookEvent $e) { $tokens = $e->return; $tokens['greeting'] = [ 'callback' => function (array $tokenData) { return ucfirst(wire('user')->name); } ]; $e->return = $tokens; }); Tokens can also include parameters that are parsed and passed to the callback function. There are more fully annotated examples and step-by-step instructions in the README on Github! Features A simple and fast token parser that calls the appropriate callback and runs automatically. Tokens may include multiple named or positional parameters, as well as multi-value parameters. A manual mode that allows you to replace tokens in custom pieces of cached content (useful if you're using the $cache API). Some built-in tokens for common use-cases: CSRF-Tokens, replacing values from superglobals and producing random hexadecimal strings. The token format is completely customizable, all delimiters can be changed to avoid collisions with existing tag parsers or template languages. Links Github Repository & documentation Module directory If you are interested in learning more, the README is very extensive, with more usage examples, code samples and usage instructions!1 point
-
This module allows you to integrate hCaptcha bot / spam protection into ProcessWire forms. hCaptcha is a great alternative to Google ReCaptcha, especially if you are in the EU and need to comply with privacy regulations. The development of this module is sponsored by schwarzdesign. The module is built as an Inputfield, allowing you to integrate it into any ProcessWire form you want. It's primarily intended for frontend forms and can be added to Form Builder forms for automatic spam protection. There's a step-by-step guide for adding the hCaptcha widget to Form Builder forms in the README, as well as instructions for API usage. Features Inputfield that displays an hCaptcha widget in ProcessWire forms. The inputfield verifies the hCaptcha response upon submission, and adds a field error if it is invalid. All hCaptcha configuration options for the widget (theme, display size etc) can be changed through the inputfield configuration, as well as programmatically. hCaptcha script options can be changed through a hook. Error messages can be translated through ProcessWire's site translations. hCaptcha secret keys and site-keys can be set for each individual inputfield or globally in your config.php. Error codes and failures are logged to help you find configuration errors. Please check the README for setup instructions. Links Github Repository and documentation InputfieldHCaptcha in the module directory Screenshots (configuration) Screenshots (hCaptcha widget)1 point
-
I've been using Fathom Analytics for a while now and on a growing number of sites, so thought it was about time there was a PW module for it. WayFathomAnalytics WayFathomAnalytics is a group of modules which will allow you to view your Fathom Analytics dashboard in the PW admin panel and (optionally) automatically add and configure the tracking code on front-end pages. Links GitHub Readme & documentation Download Zip Modules directory Module settings screenshot What is Fathom Analytics? Fathom Analytics is a simple, privacy-focused website analytics tool for bloggers and businesses. Stop scrolling through pages of reports and collecting gobs of personal data about your visitors, both of which you probably don't need. Fathom is a simple and private website analytics platform that lets you focus on what's important: your business. Privacy focused Fast-loading dashboards, all data is on a single screen Easy to get what you need, no training required Unlimited email reports Private or public dashboard sharing Cookie notices not required (it doesn't use cookies or collect personal data) Displays: top content, top referrers, top goals and more1 point
-
Hello, I would like to present you a new module which aim to facilitate the productivity of your editors/publishers when working on ProcessWire. The idea begun when my co-worker told me that when typing in ProcessWire CkEditor field he was feeling "loosing motivation" when writing big wall of text and/or inspiration. So he opened his web-browser and show me a site looking to Wordpress - feel free to put your preferred emoji here - then he opened Gutenberg... typed some text and moving some "blocks". I understood immediately why he got this feeling with CkEditor. If you or your client feel like this guy, then you will love this module ! What is currently supported ? Features Auto-save Medias upload support HannaCode support Blocks Implemented Heading Image Paragraph Embed Quote Code Link Table (beta) Block Delimiter Raw HTML Note (custom block markup) Feature Request Frontend Edition And there you go for the preview - sorry I am to lazy and bad at typing text so I had a copy/pasta moment : Module featured in the ProcessWire Weekly #317 - Thanks @teppo1 point
-
I started a proof of concept using vue to do live front end edits to processwire fields and have a question. I successfully bound the text field to the vue variable and used axios to send the post to my processwire page /post/ on save, but how do I secure this post page so others can not post edits to this /posts/ page? Thanks!1 point
-
Do you have withCredentials: true in your app config or in your request ? Without it, cookies are not saved.1 point
-
I have indeed – and I dig it from the perspective of rapid development. As I understand it though, it comes with a runtime that contains things that may or may not be used. Sure, the Alpine runtime is small, but the build file I have in Svelte is looking a bit smaller (so far). That aside, enjoying Svelte so far – this is the first time I'm exploring all of its features.1 point
-
Wow, that's a motherload of new search operators. Awesome! I usually want to include as many results as possible to so I tend use the LIKE operator for text searches. To bring in even more results it would be cool to use query expansion too, but I noticed that there isn't an operator that combines those two. Is that combination not possible for technical reasons?1 point
-
A few more ideas... 1. If the fields that are updated programmatically are only a subset of the fields in the template then you could give those fields special treatment in Page Edit. So if fields A, B and C may be updated programmatically but fields D, E and F are not then in Page Edit DEF will be rendered normally but ABC could be rendered "Closed + load only when opened (AJAX)". Or (trickier) rendered read-only via renderValue() with a button that loads them on demand via AJAX if the editor needs to change the value. The idea here is that the values for ABC are only present in the POST data if the editor has needed to load and change them. 2. In conjunction with your first idea, when your script sets field values have it also store the changed field names and update time in the $page->meta of updated pages. Hook before processInput and remove any clashing field values from POST. Use $session->warning() to alert the user if any values that they changed manually were discarded (the programmatic changes will always take priority because even if the clash doesn't happen during editing they can potentially occur one second after a user saves a manual value). 3. Store changed field names in $page->meta as per idea 2, but use JavaScript in Page Edit to regularly poll and see if any field values have been changed programmatically. If so, remove the inputfield from Page Edit and alert the user to explain. Not as bulletproof as 2 because the programmatic update could occur between polls.1 point
-
@encho you pointed to something I hadn't thought of before reading your comment. I then tried all the afternoon to work on that - I have to brainstorm more about that, but I think we could have something which works. In this sample, you can see a heading and a paragraph written in a CKEditor field. You can then change the fieldtype to EditorJS and get you saved data. As you can see - and as you stipulated as well in your last comment - the strong tag isn't taken into account. Anyway, I am quite confident to get a parser working here. I still take into account that I am not aware of how/which DOM are inserted on every CKEditor for a given user. I was thinking to alert the user if his content couldn't be parsed entirely, or something like that, and so, a manual intervention will be needed in this case. And this is how look the paragraph with inner DOM elements, should be "easy" to insert them :1 point
-
All tests done on my side - I pushed a new Release to Github. Thanks to @androbey for finding the fix1 point
-
1 point
-
= I have not thought about that and I don't know how o add any other service. ? This uses a fixed api key.1 point
-
RockFinder can massively reduce search times. I've used it to reduce complex searches from several seconds to fractions of a second. However, if your searches aren't too complex, even on a fairly large number of pages the difference could be between part of a second using PW selectors and a very small part of a second using RockFinder. This isn't really going to solve your problem. So I'd suggest sorting out the rendering first, as suggested by others, with RockFinder as a possible later refinement.1 point
-
A ProcessWire find will perform an SQL query. The important thing (in terms of performance and tools like RockFinder) is what happens next. SQL queries are normally very fast. However, if you then load the results into Page objects, you might get a performance hit depending on the number of results you fetched. RockFinder does not load Page objects, hence remains very fast and performant. It is very much suited to handling large datasets.1 point
-
1 point
-
1 point
-
Yes! The module uses preg_replace_callback to look for cache tokens and calls the corresponding callback for each occurance. BTW this also means that if you use the same token multiple times, the callback will be called that many times as well (for most tokens this will be the desired / expected behaviour).1 point