Leaderboard
Popular Content
Showing content with the highest reputation on 05/10/2024 in all areas
-
I've been continuing to work on the PageEditChildren module that I wrote about here last week. This week a "Clone" feature was added. You can click the Clone action and it'll create a copy of the page below the one you cloned, and then make it immediately editable before you even have to save. This Clone action is an example of an Inputfield header action, and it accompanies the Move, Pub/Unpub and Trash actions for each page in PageEditChildren. I thought this ability to add Inputfield actions seemed useful beyond just this module, so the ability has been added directly into ProcessWire's core Inputfields JS API. If you grab the current dev branch of ProcessWire, you can test it out if you'd like. You can paste these examples in your web browser's Javascript console. But in actual web development, you'd likely put these in a separate JS file that is added to your page editor with a hook. Open the page editor to any page, then open your Javascript console in your web browser, and then paste this in: Inputfields.addHeaderAction('title', { icon: 'fa-hand-stop-o', callback: function() { ProcessWire.alert('Hello World!'); } }); That should add a hand icon to your "Title" field header, and if you click it, it'll pop-up a dialog box that says "Hello World". Let's say you wanted it to show a different icon when you hover it, and also to show tooltip text via a title attribute. You can add the 'overIcon' to specify what icon to show on mouseover, and 'tooltip' to specify the tooltip text: Inputfields.addHeaderAction('title', { icon: 'fa-hand-stop-o', overIcon: 'fa-hand-peace-o', tooltip: 'Hello world', callback: function() { ProcessWire.alert('Hello World!'); } }); Above are examples of 'click' actions. We also support toggle or "on/off" actions: Inputfields.addHeaderAction('title', { onIcon: 'fa-toggle-on', onTooltip: 'Click to toggle off', onCallback: function() { ProcessWire.alert('You toggled on'); }, offIcon: 'fa-toggle-off', offTooltip: 'Click to toggle on', offCallback: function() { ProcessWire.alert('You toggled off'); } }); Toggle actions like this are primarily what is used by the PageEditChildren module to handle the Published vs Unpublished state, and Trash on/off state. Whereas "Clone" is an example of a Click action. Our callback functions in the examples above are very simple alerts, but of course you could make it do anything you want in those callbacks. Also added this week to the Inputfield JS API was an update to the Inputfields.label() function that now allows you to set the label for an Inputfield (previously it could only get the label). This is a bit of a contrived example, but since we were talking about header actions above, let's demonstrate the label() function within a header action. This example adds an action that lets you edit the Inputfield label: Inputfields.addHeaderAction('title', { icon: 'smile-o', callback: function($f) { ProcessWire.prompt('Enter new label', 'Label', function(val) { if(val) Inputfields.label($f, val); }); } }); By the way, there's a lot more to the Inputfields JS API, and it's all documented directly in ProcessWire's inputfields.js file. I'll be bumping the core dev version next week to hopefully accompany the first version of the PageEditChildren module. Thanks for reading and have a great weekend!10 points
-
File Mover Allows the selection of files or images for moving or copying to a different field. The destination field can be on the same page as the source field or on a different page. Screencast For convenience in the screencast this demonstration shows moving and copying images and files between fields on the same page, but you can also move/copy between pages by following the same process. Usage In any Images or Files field, hover on the field label to show the File Mover icon. Clicking on the icon will reveal the File Mover buttons. If no items are yet selected you'll see a button labelled "Select items to later move or copy". Click the button to enter selection mode. While in selection mode, click one or more images/files to select them. When you have finished selecting items click the "Done" button. Note: you can only select from one Images and one Files field at a time before completing the move/copy step. In the Images or Files field that you want to move/copy the items to, hover the label to show the File Mover icon and click it to reveal the File Mover buttons. When you click the Move or Copy button the page will automatically be saved and the selected items will be moved or copied accordingly. There is also a button to clear the current selection if needed. If you hover on any of the buttons a tooltip shows the filenames of the currently selected items, in case you need a reminder. Configuration There is a field in the module config that defines which roles are allowed to use the File Mover module. If the field is left empty then all roles are allowed. https://github.com/Toutouwai/FileMover https://processwire.com/modules/file-mover/9 points
-
I've been using ProcessWire for a long long time and over the years my techniques and go-to approaches have been constantly refined. A lot of this knowledge is codified in my internal heavily opinionated starter module that sets up everything up the way I like. Even with that, there are other tips, techniques, and modules that I may use occasionally on client sites and because of that, I may not remember them months or years later. I do have a document that I've been better at updating recently with this information, but in addition to that, I think to really remember a piece of knowledge it's best to actively use it even if not necessary. The best place I've found to do this is on my personal website. I treat my personal website as a semi-testing ground, a reminder of techniques and the generally the first place I will use something that maybe gets used on my other client websites. Even if I don't really need some specific module, need that odd hook, or require a specific setting, I will deliberately use it on my personal website because I have total control over it, it's live (meaning I have both a development and production version which allows me to test my deploy and sync scripts) and if something breaks temporarily it's not a big deal. For example, I'm doing the following on my personal site: various hooks that modify the admin; adding custom markup fields in the page editor for certain templates using dotenv (maybe eventually use this everywhere, but only here for now to codify the latest approach on this) using rockshell with some custom commands that I don't really need have a random snippet for tracydebugger in /site/templates/TracyDebugger/snippets/ created all the other special status files in /site/ (boot.php, download.php, failed.php, render.php) blocking the vendor folder in .htaccess have a random rewrite rule in .htaccess using ProcessRedirects with a random rewrite rule disabling sessions purposely have a dash in the name of my database (did you know Microsoft purposely put a space in the "Program Files" directory so that developers properly handle paths with spaces in it?) using Page Edit Lock Fields on my home and about page (yea, locking the page from myself!) experimenting with the AdminBar module and hooks, even though I won't use this module (I have my own admin bar that loads via ajax) overriding styles in the ProcessWire's admin bar (making the font small, smaller spacing, full width container) have a humans.txt file separately, using Matomo even though I don't really care about analytics for this site my deploy script deploys some extra random directories even though I don't need them have a separate user account that's been assigned the AdminThemeBootstrap theme I am working on using a honeypot field on my formbuilder-based contact form (I use this everywhere) I have a note (which is basically the above list) that I add to so it's easy to remember what I did, why and references to it (forum post, github, blog post, etc.). --- Separately, I have another completely blank ProcessWire installation with nothing extra done to it (except TracyDebugger). I use this to test and experiment various things (sometimes unrelated issues) when I don't want any hooks or installed modules potentially modifying anything. I'll also install modules here that I'm not so sure about. If I suspect I hit a bug with ProcessWire in a separate installation, I'll experiment here as well. Once I'm done fully experimenting and the issue has been resolved, I'll make a note in a log of what I did then undo my changes bringing it back to a clean slate.6 points
-
You could also simply get the parent by using the parent property. Of course you don't need to use setAndSave() but I feel it's cleaner in a situation like this. I also like using $p rather than $p because even though the scope will prevent $page from overwriting the PW $page object, I still find it less confusing, but that's just a personal preference. $wire->addHookAfter("Pages::published(template=post)", function (HookEvent $event) { $p = $event->arguments(0); $blog = $p->parent; $blog->setAndSave('date_modified', $p->date_modified); }); Also, in case you don't know, there is a system "modified" property rather than adding a separate custom field for that. Another thought - if updating the modified date for the blog parent is just about using it to display on the website, perhaps you can just get the modified date of the most recently modified post, eg:4 points
-
I totally support this. Since the tweaks part of RM can be expected to grow, I also think it would be better to have this in a separate module. RM really should be what it states: the ultimate automation and deployment tool. This is where it shines. I'd be sad to see it become bloated with functionality not related to that. Just my honest opinion.4 points
-
Hi all, I am turning out to be a liar at this rate! I really should stop talking about 'tomorrow'. I can only apologise. Projects and Padloper 009 kept me very busy the last many months! I wasn't able to do much on MM next. During that time, I realised that a number of underlying concepts of MM had to change. Hence, I started a re-write of MM but the pace was slow due to afore mentioned reasons. Now that Padloper 009 is out of the way, my main coding focus is on MM! I am quite confident that I'll be able to have a release within a month. This will be a late alpha or early beta, but at least something that can be tested. I don't take your patience for granted. I am trying my best not to let you down this time ?. Thanks!2 points
-
Paging Dr. @bernhard! I'm kicking off a website project (likely the largest I've ever taken on before) soon and, of course, RockPageBuilder will be used ? It's for a large public event that will have hundreds of pages for event activities, information about entertainment and things to do around town, lodging, sponsors, promote tickets sales, etc. as well as a branded "magazine" style blog. It's going to require a lot of diversity in content and design. My question: is it possible to have multiple RPB fields with the ability to implement blocks as such: Have blocks that are available to all RPB fields (as it does now) Assign blocks to multiple RPB fields, but not all Assign blocks to just one RPB field exclusively In my case this is very useful as the "magazine", events, and main pages each have unique design elements and I would like to let users use blocks without using them where they shouldn't be and "breaking" the design of the website, so to speak. If this is possible I may have to file for divorce and marry RockPageBuilder.2 points
-
Could be because $page->isNew() doesn't match the page as a page is only new right after it was created. So... the moment you publish that page it is already old. $wire->addHookAfter("Pages::saveReady(template=basic-page)", function ($event) { $page = $event->arguments(0); $pages = $event->object; if ($page->isNew()) { wire()->log->save("debug", "page is new"); } else { wire()->log->save("debug", "page is NOT new"); } }); $this->addHookAfter('Pages::published', function (HookEvent $event) { $pages = $event->object; $page = $event->arguments(0); // add conditionals here wire()->log->save("debug", "page was published"); }); Second example uses this hook: Pages::published2 points
-
Here's my first attempt at a public repo for Rock Admin Tweaks. Has the AdminOnSteroids tweaks from above, and my QuickWebAuthnLogin already ported over from RockMigrations.2 points
-
Hi, this issue can be resolved. Kindly find procedure in the link below: https://medium.com/@njokdan/making-processwire-work-on-azure-after-deployment-15261d2d22912 points
-
@bernhard, is that module not deprecated in favor of migrations tweaks? If not, shouldn't we be encouraged to develop the Tweaks module instead? Does it have its own support thread?2 points
-
https://github.com/baumrock/RockAdminTweaks2 points
-
2 points
-
I really like the idea with a tweaks pluggable collection. But I would prefer its usage was separated from the RockMigration module, so one could use tweaks without the more developer-centric migration tool. I thought that @bernhardstarted a dedicated module for that, but not sure if it is still alive.2 points
-
Hi guys, I might have an interesting project in the coming months. For now, I have to give a quote for this job. The project is a website where different kinds of users could post ads about pets for adoption or for sell. This means that I must be able to handle hundreds of users with an account (three different kind of accounts : private, association and animal professionals) and hundreds, maybe thousands of pets. My first thought is : PW + AlpineJS. I read that PW is capable of handlings hundreds of thousands of pages. I begin now to be quite familiar with PW API, and AlpineJS would let me bring some interactivity. My second thought : PW headless, acting as a REST API provider, and Svelte for the front end (I never used Svelte, but it seems nice and quite light weighted, it would be an occasion to learn on a real project – I learned a little bit of React but never had the occasion to use it for real projects). I’m afraid Svelte would be a bit of an overkill, I don’t really need advanced reactivity and all that. But it could be a way to broaden my horizons. My third thought : Laravel for backend (never used it – I’m a bit familiar with Symfony, but Laravel seems more light weighted). The publishing needs are not big : create an account, publish a pet file. And that’s it. So maybe (maybe !) a PHP framework would go straight to the point. I could even develop it from scratch, but I don’t trust myself 100% about security. What would be your choice ? Any clue about the time you would need to do that ? My guess is about 80-100 h for the first solution. I am very eager to hear some experienced guys' opinions... Thanks in advance.1 point
-
Then we could use the system "published" property, no? Regardless, even if there is a need for a custom date field of some sort on the post template, that could still drive that getRaw() example I posted. Not saying it's the right way to go - just highlighting some other options.1 point
-
I thought exactly the same, but I think he wants to show the published date and not the modified date? So if anyone edited an already published blogpost the date would NOT change. At least that's what the hook does as far as I understand. Maybe this shows that the naming of "$blog->date_modified = $page->date_modified;" might not be ideal ?1 point
-
Incorrect! You must demonstrate to employers you understand React because everyone is using it (aka Resume Driven Development). Here's what ChatGPT recommends to write in resume-speak (it took a few refinements to get this): "Acquired advanced proficiency in React.js through extensive development experience with WordPress Gutenberg."1 point
-
My eyes. I think String Theory will be easier to comprehend. Seriously though, imagine in 4-5 years as the team behind that creation withers away (as they find new jobs) and the domain knowledge leaves the company, with new team members taking over and having to maintain and build upon THAT. It's going to get worse before it gets... worser? WordPress is bad for your mental health.1 point
-
This might also be helpful, I don't know, I tried ? https://youtu.be/ncS36UqaBvc?si=SYhVc_qcaN5lneDP&t=355 All the best for your journey!1 point
-
? This is outstanding and I love the implementation. Being able to choose where blocks are available/rendered using a function is really powerful, even better than I hoped for. As usual, RPB continues to deliver so many great features that I wouldn't be surprised at all if this module even made coffee. My wife is really not going to like this.1 point
-
Hi @FireWire thx for your kind words and congrats for the project! I think what you are trying to do is already possible, it has just not been documented yet ? So I've added it to the docs for you: https://www.baumrock.com/en/processwire/modules/rockpagebuilder/docs/blocks/#conditional-blocks Does that do what you need? As mentioned in the notes you could also hook into "getAllowedBlocks". Or you can also create different fields and share blocks across those fields. The easiest solution is the "show" property in the info method if you can trust your users to some extent. Your project sounds great, would be awesome if you shared the result with us once it is online ? All the best!1 point
-
@wbmnfktrthanks mate!!! I count beers I owe you.... So for anyone looking at this here is the solution: $wire->addHookAfter("Pages::published(template=post)", function (HookEvent $event) { $pages = $event->object; $page = $event->arguments(0); $blog = wire('pages')->get('template=blog'); $blog->date_modified = $page->date_modified; $blog->save(); // wire()->log->save("debug", "page was published"); });1 point
-
In case you have time this weekend: Saturday: enjoy a day reading the docs and tutorials Sunday: enjoy a day of tinkering with the installation, a site profile, maybe first steps In addition to that I recommend this 10 year old video: ProcessWire looks way different nowadays but the steps are the same. And you can see how easy it is (or can be) to get started.1 point
-
The learning curve and time depends on your definition of a „decent standard“ for your local development environment and operating system used. For example. I bought a new Windows 11 Laptop recently and just wanted to upgrade my dev environment I used for about 10 years now (Windows 10, XAMPP, VS Code with several Addons) to a decent standard on Windows, which is WSL2 (Windows Subsystem for Linux), DDEV (replacing XAMPP), and installing all the stuff previously hosted on Windows in the WSL2/Ubuntu env co-existing with Windows 11. This took me about 5 days until I get used to Docker/DDEV stuff etc. When I first tried Processwire a year ago with a specific project (event booking system for 1-10 departments with 1.000 users/department) in mind, where I didn‘t want to implement authentification, logging, permissions, database queries in vanilla PHP myself, it took me a weekend to go from project idea to a working demo for one department with my existing PHP knowledge (last PHP project was in 2018). I just installed a default site template with delayed output strategy, read me through the API and tutorials and asked questions in the forums and the demo turned into pilot tests after about 2 weeks and went live with three departments after 4 weeks. Up to that time I wrote three modules (two publicly available from the PW module store) and one backend module for private use. So to recap. If you just use your existing local dev env, you can get results fairly quick using the PW API and the snippets in the tutorials. Another great resource are the code comments in the PW core files on Github. If you want to upgrade your local dev env to some decent/recent setup, it will take somewhat longer. The extra time I spend with setting up my local dev env amortized about 1-2 weeks later, due to the better workflows and toolchain like DDEV/WSL2, which I won‘t miss anymore. Cheers cwsoft1 point
-
I was unaware of RockAdminTweaks and have now installed it alongside RockMigrations. Porting the tweaks over is very simple (just a change to the namespace in the tweak file) and I prefer having them in the assets folder as well.1 point
-
Not yet, I guess, based on the loadTweaks method.1 point
-
@Mats, I've released the module I mentioned above: If you want to use Media Lister to find an image and then copy it to a field in Page Edit you can follow these steps: Open Media Lister in one browser tab, and Page Edit for the page you want to copy an image to in another browser tab. Find the image you want to copy in Media Lister. Click the link in the Page column - this will open the page that contains the image in Page Edit and will focus the containing field. Use File Mover to select the image you want to copy. Switch to the browser tab that contains the page you want to copy the image to. In the destination field use File Mover to copy across the image you selected in the previous step.1 point
-
Great, thanks very much all. I guess I just need to get stuck in and give it a go - I've been going round in circles for some time wandering what to learn, so really just getting stuck in to something, anything, will be a good idea! You've given me some good pointers so I'll get on with it, thank you.1 point
-
I think ProcessWire's opinions are very worth it. The ones that I feel are right at hand are the selector API and the concepts associated with a Page. This allows you to reduce the amount of decisions you have to take and later execute, letting you go straight into making that real estate/portfolio/etc you want to build. I'd say that with very little backend experience you can build something nice and fast in ProcessWire, with a very advanced and minimalistic and powerful admin backend out of the box. I'd encourage you to give it a try, at least a couple days of work. Give ddev a try to setup your development environment. If you find yourself at trouble don't hesitate to write back, it's an awesome community!1 point
-
Yes, that's right. I use maybe 5 or so features from AoS and figured porting those over would be a good way to learn both how AoS does it, and how your tweaks work. I'll add as PRs, with attribution to tpr, as I go. Updated to add: First four tweaks from AoS done and in as a pull request. Show extra actions by default. Show template name as a link to the template edit page. "Bypass trash" adds the Delete button to the page action list and also allows permanent deletion from the delete tab when editing pages. Prev/Next page edit links.1 point
-
Glad you like it! That would really be a different purpose than what this module is for. So that idea would be for a different module rather than a feature of this module. Although it wouldn't work exactly as you describe, as it happens I have another module that's 90% finished and just waiting for a core issue to be resolved. This module is designed to make it easy to copy or move images from one field to another, so it could be used together with Media Lister to copy an image, just with one or two more steps. I'll come back and explain more once the module is released. But as a general thing, are you sure you want to be duplicating image files across the site like this? If you have images that need to be regularly reused on different pages you could look at an "image reference" solution instead, so the image file stays in a single place and is referenced on other pages. My Select Images module provides for a basic solution, but if you need more power you could look at a "page per image" approach which is used in modules such as Media Manager and Visual Page Selector by @kongondo1 point
-
Upgrading plugins? Contact Form 7 changed IDs in their shortcodes for embedding forms from incrementing integers to hash based strings. From the release notes: orly. You see- upgrading the plugin replaced all of the IDs for the forms. It didn't add hashing, it replaced all of the integer IDs in the database during the plugin update process. Instant borkification. I've dipped my toes in programming once or twice and I can tell you that seems like a pretty big oversight... TO THE GOOGLES! First result was a support thread for this issue on the plugin's website. Hey- marked resolved, day has been saved! But there's no actual solution in the thread. IT WAS A RUSE. So here we are. Just in case anyone using WordPress needing help on Contact Form 7 is still looking for a solution and stumbles on this thread, I'll provide it here on a different CMS' support forums: Go through your entire site and replace all of the existing shortcodes for all of the forms wherever they were added on pages and templates with the new ones. By hand. Couldn't be easier. The mostest popularest user-friendliest CMS strikes again.1 point
-
Some reporter had the incredible chance to capture a team of developers successfully completing a full WordPress update. A very rare and intense footage: (reading your messages, this is how I imagine WordPress ? )1 point
-
Oh, what's this? Another completely different site borked itself? Performed an update using an automated tool through the web host where the core and all plugins are updated at the same time. Is there a right way to update WordPress? The world may never know... This update has has rendered the Admin unusable and inaccessible. Time for a server rollback! Okay! We're back... oh boy... Did you know? Deactivating plugins in the wrong order can make the plugins page hang on a redirect loop every time you try and access it. Time for a server rollback! (Before someone says "that was a caching issue", no it wasn't) Okay! We're back... oh boy... Did you know? In WordPress, a commercial theme or plugin you've purchased and installed may install other commercial plugins that require their own license. When that license expires, you may have to pay for a separate license for the plugin that the plugin/theme you already purchased installed when it comes time to upgrade. PROTIP: the commercial plugins that were installed by the theme or plugin you purchased are not easily recognized as a dependency or indicate what plugin/theme installed it- so, when working on WordPress, keep a shovel handy in case you have to start digging!1 point
-
I'm quite sure you did, but just in case: Did you check if there is a plugin that can fix your issue?1 point
-
3 hours on the books, issue isn't resolved, hosting company is rolling the entire site back due to possible database data loss. Updating core and plugins didn't solve the issue. Online ordering remained down due to broken connection to the merchant service which worked before a random automated WP upgrade last week. It was already rolled back last week, site stayed online for a couple of days and then went down again. In addition to that, an unstable WP plugin API made their custom theme break and return HTTP 500. The amount of casual breaking updates in the ecosystem is... impressive.1 point
-
The better the questions the better the answers. You cannot expect that forum members can remember the exact problem that you have posted several weeks ago. Describe your problem. Try to make it reproducable (eg by providing a site profile of a clean installation that shows the problem) and I'm sure there will be someone who can help you. Sometimes even describing the problem as good as you can brings you to the solution ?1 point