Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/14/2024 in all areas

  1. The core dev branch version has been bumped up to 3.0.240 this week. As always, see @teppo's excellent ProcessWire Weekly for details on what has been added recently. More can also be found in the commit log. This week adds the ability to hook into ProcessWire's admin live search to add your own custom results. This is useful for modules or for your own hooks placed in /site/templates/admin.php. Previously, only modules implementing the SearchableModule interface could manipulate the admin search engine results. Now there's another even simpler way to do it. We'll focus on examples placed in /site/templates/admin.php, but they could also go in /site/ready.php, /site/init.php or in an autoload module's init() or ready() method. The following is a simple example for when one types "today" into the search engine, it returns search results of pages that were modified today. $wire->addHook('ProcessPageSearchLive::findCustom', function(HookEvent $event) { $data = $event->arguments(0); // array $search = $event->object; // ProcesPageSearchLive $group = 'Pages modified today'; // description of this type of search if($data['q'] === 'today') { $items = $event->wire()->pages->find("modified>=today, include=unpublished"); foreach($items as $item) { $search->addResult($group, $item->title, $item->editUrl); } } }); The point of that example is just to demonstrate something simple. In reality, that example isn't that useful because you can already type "modified>=today" to get the same results in the search engine. So let's look at a potentially more useful example. There have recently been requests for better "id" search support in the search engine. In this next example, we add support for "id=123" searches, where it will match templates, fields or pages having id "123" (or whatever ID you specify). Further, it will also support it if you just type "123" on its own. Here's how we might accomplish that below. We'll limit this particular type of search to the superuser since this hook doesn't have any access control checking. if($user->isSuperuser()) { $wire->addHook('ProcessPageSearchLive::findCustom', function(HookEvent $e) { $search = $e->object; /** @var ProcessPageSearchLive $search */ $data = $e->arguments(0); /** @var array $data Search data */ $type = $data['type']; // what to search $q = $data['q']; // search query text // support search of "id=123" or just "123" // skip search if not an "id" search, or query is not a number if(($type != 'id' && !empty($type)) || !ctype_digit($q)) return; // reduce default search operator "%=" to just "=" (if used) $operator = trim($data['operator'], '%'); // search for id in templates, fields and pages foreach(['templates', 'fields', 'pages' ] as $apiVarName) { $apiVar = $e->wire($apiVarName); // get API var $selector = "id$operator$q"; // selector i.e. id=123 or id<10, etc. // some additional considerations for page ID searches if($apiVarName === 'pages') { // PW already handles "id=123" for pages, so skip that kind if($type === 'id' && $operator === '=') continue; // add more to selector for page searches $selector .= ", include=all, limit=$data[limit], start=$data[start]"; } // find by selector $items = $apiVar->find($selector); // tell ProcessPageSearch which results we found foreach($items as $item) { $title = $item->get('title|label|name'); $url = $item->editUrl(); $search->addResult($apiVarName, $title, $url); } // optionally return false to tell it to stop searching after this hook // which would prevent the default behavior of the search engine // $e->return = false; } }); } As you may (or not) know, the search engine displays help if you type the word "help". Help for the search engine usually consists of example searches and descriptions of what those examples do. If we want to add some help for our example above, we could add this to to the top of our hook above, perhaps right after the $data = $e->arguments(0); line: if(!empty($data['help'])) { return $search->addHelp('ID Search Help', [ 'id=1234' => 'Find templates, fields, pages with id 1234', '1234' => 'Same as above but “id=” is optional', ]); } That's the gist of it. These are fairly basic examples but hopefully communicate enough to show that you can add any kind of results you want into the search engine. Right now it's pretty simple and enables anyone with a ProcessWire site to add custom results into the admin live search. But if you find your needs go beyond this, the SearchableModule interface does support more options too. It's also worth using TracyDebugger to examine the $data array that the hook receives, as there are several other things in there you may find useful as well. Thanks for reading and have a great weekend!
    8 points
  2. Version 2.2.0 is out! This version is a bigger update, so I have decided to change the version number from 2.1.xx to 2.2. Whats new? This version includes a new admin module called "FrontendForms Manager", which is an easy to use UI for entering as many questions as you want for the "Simple question CAPTCHA". At the moment this module is only for entering questions, but I have plans for the future to expand the functionality. That is the reason why I do not call it only "Question Manager" or something like that. The "Simple question CAPTCHA" is a CAPTCHA type that I have added not so long ago and it forces the user to answer a simple question before submitting the form. You will find a live example using this new module with the simple question CAPTCHA here: https://www.schulfreund.at/kontakt/ Unfortunately, this page is only in German, but you will get the idea how it works ? I have not so much real life experience with this CAPTCHA type, but @Andi from the forum uses this type of CAPTCHA very heavily and he had no problems with SPAM until now. So if you have troubles with SPAM, give this CAPTCHA type a chance to be your friend ?! The only disadvantage of this CAPTCHA type is, that you have to create your questions first. But the big advantage is that you can adopt the questions to your customer, so that the CAPTCHA has a more personal touch. The usage of this module is optional, so it will not be installed automatically during the update. You will need to got the module manager and install it like all other modules. I do not want to go to much into detail, because I have written a description of the FrontendForms Manager in the Readme file on Github. There you can find also more images about the Userinterface. So take a look there to get more information about it. Here is only a brief description about the funcionality of this module: Creates a new admin page under Setup called "FrontendForms Manager" After clicking the link you will be redirected to the "Dashboard" The Dashboard page contains some statistical data about the questions and a little statistical section with charts By clicking on a button on the "Dashboard page" you will be redirected to the next page which contains all questions inside a table (a kind of questions overview page) There you can select if you want to edit/delete or to add a new question Depending on your choice you will be redirected to an "edit" or "add new" page where you can enter the several data for the question Each question is highly customizable, which means that you can enter notes, description, error message, success message etc. individually for each question As always, this is a brand new module, so it is not recommended to try it out on a live site first. I have run several tests without problems, but I cannot cover all possible scenarios. If you discover any problems, please report it here or directly on GitHub. Special thanks goes to @bernhard for writing a fantastic tutorial on "How to create custom admin pages". This tutorial helped me a lot during the development of this module. Jürgen
    5 points
  3. So I started playing around with Supermaven's free tier. If you are looking for a code assistant for VSCode I would recommend giving it a try. I started using it after Theo covered it in one of his tool videos, and I can say it probably shaves about 15 minutes of work per hour for me. It does a reasonably good job of anticipating structures you are building based on a quick overview of the codebase for your project. I haven't extended the codebase to include the entire source for processwire in my projects, but even with just the minimum core wire folder modules and a few site module source code bits it is more than enough to cover the bases. I am using the free tier which has a smaller token context limitation, but the code suggestions are fast, they don't feel inappropriately intrusive and don't write-ahead too far until the engine has high confidence in the direction you are trying to go. When it has high certainty, it opts to give you large code blocks - even entire functions with appropriate substitutions. It has sped up my RockMigration script writing considerably - beyond the macros, because it sees other migration functions I have defined and does a very good job of anticipating not only the class structures for custom page classes, etc, but also replacing names for new classes with proper singular/plural forms, etc. I'd say it provides the correct code without modification 85% of the time. https://supermaven.com/
    3 points
  4. Although they have been bought by Canva, once I got used to how Affinity does things their Photo/Designer/Publisher trinity is my daily driver - particularly with the improvements finally brought to Publisher to make it feature complete with Serif's prior publisher (proper endnotes/footnotes support). And they do run on Linux with Wine and a bit of massaging: https://codeberg.org/Wanesty/affinity-wine-docs
    2 points
  5. Padloper 009 I am pleased to announce the release of Padloper 009! It has been a minute! I apologise for the delay. Padloper 009 introduces a number of new features, bug fixes (especially in Multilingual sites) and improves overall code efficiency. Credits Before I get into the details, I would like to say massive thanks for all who have contributed to this release in various ways. You have contacted me via the forums, via PM and via email to report bugs, test Padloper and suggest and sponsor new features. In particular, I would like to thank (in no specific order) @Spinbox, @alexm, @joe_g, @ank, @csaggo.com, @Jan Fromm, @Pete, @Sonia Margollé and @kalimati. Whilst I will not name those who contacted me privately, please accept my gratitude for your help. Apologies if I forgot to give anyone a mention! Massive thanks to @ryan for ProcessWire. Padloper 009 is the most battle-tested Padloper yet! It has been tested and developed on high volume sites, sites that require lots of customisations and multilingual sites whose default language is not English. This robust development has helped fix bugs that I would not have been aware of otherwise as well as new ideas and features to improve the API, workflow and GUI of Padloper. Many of the suggested features have made it into this version. A few others are planned for the future. There is a lot to talk about in this version. Below I’ll just give a summary of the changes and where necessary, create separate topics to discuss some of the new features. Although Padloper 009 has undergone thorough testing, there might, inevitably, be some bugs. If you find one, please let me know in the forums under a separate topic. Thanks! Changes Features Home Customisable dashboard. You can render your own dashboard by creating a template partial named ‘padloper-process-render-shop-home.php’ and placing it at ’/site/templates/padloper/backend/padloper-process-render-shop-home.php’. Please see this thread for more details. Orders Customisable single order view. You can render your own dashboard by creating a template partial named ‘padloper-process-render-orders.php’ and placing it at ’/site/templates/padloper/backend/padloper-process-render-orders.php’. Please see this thread for more details. Order status actions: Can be applied manually for order, payment and shipping status. Quick filters e.g. ‘open’, ‘cancelled’, ‘abandoned’, etc. Products Configurable pricing fields. Sales and Normal Price (e..g WooCommerce) vs Price and Compare Price (e.g. Shopify). Please see this topic for more details. Categories can optionally be named ‘Collections’. Configurable via ‘/admin/shop/configure-padloper/’. Bulk clone existing products. Allow duplicate titles for products. Discounts (new) 4 discount types: Orders, products, free shipping and BOGO (Buy One/Get One - unfinished; see below). Can be applied manually or automatically at checkout. Please see this thread for more details. Add/remove via ‘/admin/shop/configure-padloper/’. Part sponsored by Nifty Solutions. Thanks @Pete! Customers and Customer Groups (new) Customer creation and management. Please see this thread for more details. Customer Groups. This feature will be expanded in the future. Please see the above thread for more info. Add/remove via ‘/admin/shop/configure-padloper/’. General Settings Redone interface Add ‘from email’ settings.. Add bank details settings.. Add order ‘least and most’ sales thresholds for orders’ quick filters. Settings for ‘low stock’ and ‘price fields’ for products. Add tab ‘user interface’ with settings for shop navigation (can have side menu and/or dropdown navigation) and search features (can use quick filters and/or advanced filter). Other Backend Quick filters on various dashboards. Custom Dashboards for Home and Orders. More to be added in future. Frontend Custom shop root page. This allows you to move product-related pages and legal pages to live under a frontend-accessible page. Configurable via /admin/shop/configure-padloper/. Please see this topic for more details. For instance, /myshop/products/, /collections/, /products/, etc. This means you can directly access products on the frontend using their real paths/urls instead of using URL segments. This setting can be changed anytime via configuring Padloper at /admin/shop/configure-padloper/. Custom URL segments for checkout out. E.g. instead of /checkout/success/, /checkout/confirmation/, etc., you can have custom, multilingual segments, e.g. /checkout/order-success/, /checkout/tilaus-menestys/, etc. Miscellaneous Various UI improvements. Dashboards tables sorted by title by default. Breaking Changes Template partials for the frontend have been moved from /site/templates/padloper/ to /site/templates/padloper/frontend/. Deprecated ‘Search Feature’ on the home dashboard has been removed. Use ProcessWire in-built search instead. Padloper hooks into it to group padloper related results. PadloperProcessOrder::orderSaved now becomes PadloperProcessOrder::orderSavedHook.The new approach is to have all hooks in one please for easier maintenance and usage. Bug Fixes Please see the bug fixes topic. How to Get It Padloper 009 is available at https://processwireshop.pw/products/padloper/. For those renewing subscriptions, you will have to wait a bit, apologies. I am finalising work on renewal codes. I am hoping this will be ready by tomorrow. Any issues with the (revamped ?) site please let me know ?. Upgrading This is a major upgrade. Lots of code has been moved around. Best way to upgrade files is to empty the contents of the root Padloper folder and upload the contents of the new version there. There are no data model changes affecting existing features but as always, back up your site(s) first! Next Steps In addition to fixing any bugs that show in 009, these are the plans for the next 3-6 months, possibly more, in order of priority. No new features will be introduced until these are completed. Documentation Documentation will cover all topics including installation, backend and frontend use and the API. ‘How to guides’ will consist of short videos with corresponding textual content on a dedicated Padloper site. Discounts Finish work on the Buy One Get One (BOGO) Discount and automatic discounts. Gift Cards Finish work on Gift Cards. Road Map I will talk about this when the ‘next steps’ tasks have been completed. Thanks!
    1 point
  6. Hi everyone, We have a new module for you: the UpdMostViewed module. It's an addition to your ProcessWire site that enables you to track page views and deliver a list of your most visited pages within a given time range. This data is particularly useful for creating frontend features like a "Most Read Articles of the Week" widget. Installation You can choose to: Head into your ProcessWire backend, go to Modules > New and search for the Module UpdMostViewed. Get the module directly from the latest releases on our GitHub repository. If you're using Composer for your project, you can add the module by running the command composer require update-switzerland/updmostviewed in your project root directory. Once downloaded, you can install the module via the ProcessWire admin. Configuration The UpdMostViewed module provides you with a variety of configuration options. You can exclude certain branches, specific pages, certain IPs, restrict counting to specific templates, define which user roles to count, ignore views from search engine crawlers, and more. Moreover, you can also customize the time ranges for the "most viewed" data. Links For more detailed information on usage, updates, or to download the module, please visit our GitHub repository and check out the module in the Module Directory.
    1 point
  7. You didn’t told us what’s the result if you set / change your hook priority. edit: and are you 100% x 3 sure that roles and permission are the same on both envs ? edit2: (again ?) profiling your code will give you more skills than copilot, and loose less time on this whole thing. edit3: you should read this issue to see if it help about what are trying to achieve: https://github.com/ryancramerdesign/ProcessWire/issues/302 edit4: what the bot say: The issue could be related to the priority of hooks and the sequence in which they are executed. In ProcessWire, hooks can be attached in different methods such as init()and ready(). The init() method is called before ProcessWire handles a web request, while the ready()method is called after ProcessWire determines what page is going to be viewed but before the page is rendered. If the module ready is called earlier, it might affect the sequence in which hooks are executed, potentially leading to the observed issue. To solve this issue, you can try the following steps: Ensure that the hooks are attached in the correct method (init() or ready()) based on when they need to be executed. Adjust the priority of the hooks to control the order in which they are executed. Additionally, you can use the standardized include/hook files provided by ProcessWire: /site/init.php: This file is included during ProcessWire's boot initialization, immediately after autoload modules have been loaded and had their init() methods called. This is an excellent place to attach hooks that don't need to know anything about the current page. /site/ready.php: This file is included immediately after the API is fully ready. It behaves the same as a ready() method in an autoload module. The current $page has been determined, but not yet rendered. This is an excellent place to attach hooks that may need to know something about the current page. By ensuring that your hooks are placed in the appropriate files and adjusting their priorities, you should be able to resolve the issue with the listable status in the live environment.
    1 point
  8. For 20+ years I've always maintained a Windows box and a Linux box connected via a KVM switch and with a dual monitor setup. I also have a somewhat older Intel IMac I keep for various tasks. I haven't given it much thought as I regularly switch between Linux and Win10 throughout the day. As far as distros go, I'm using Ubuntu 20.04 KDE and will probably upgrade (clean install) after summer sometime. My $0.02...
    1 point
  9. The larger picture of why I'm doing this is to overall De-Google, De-Microsoft and De-Apple my life as much as possible (surely there will be exceptions). It's not about saving money or privacy (those are very very minor points), but personal optimization, control, me being ready for it, Linux desktop having become really great in the last X years, and taking a stronger liking to FOSS and self-hosting.
    1 point
  10. KDE Plama user here and very happy with it (currently KDE Neon but sometimes Kubuntu). I do also own a Mac becasue we sometimes build apps which needs me to use XCode, and I have a laptop that I can dual boot into Windows but I can't even remember the last time I had to do that and most of my day is spent in Linux. I'd agree that the main drawback is the gap in graphics software. I use Affinity Designer on the Mac which is great, but whilst it nearly runs in Wine it's not quite there yet. Apart from that my development stack on Maxc and Linux is pretty much identical so it's dead easy to swap between them. The designers I work with nearly all use Figma these days so it's been a while since I was given a PSD anyway (which Affinity Desginer deals with very well). You should definitely give Plasma a go if you want to be able to tweak your desktop .... although I warn you will spend a lot of time tweaking your desktop ....
    1 point
  11. Customers and Customer Groups are new features in Padloper 009. Customers You can add/remove this optional feature at any time via ‘/admin/shop/configure-padloper/’. This feature does not require the 'Customer Groups' feature. Please note that there is no direct relationship between a 'shop customer' and an 'order customer'. This decoupling allows for a better delineation between guest and non-guest checkouts. The field for storing order customers is separate from the field for storing shop customers. The former is a 'permanent' record of a transaction (an order) in your shop. There is no direct link between a shop customer and a ProcessWire user, until you link them. Padloper allows you to do this easily. You can add customers to your shop either via the API or the admin. Note: When creating a customer, you have the option to create a (ProcessWire) user account for them as well. You can also do this later when editing the customer. Padloper does not handle the customer registration for you. This is because some devs prefer to send customer a link to register whilst others prefer emailing a temporary password to the customer. Padloper allows you to handle the registration and pass the details back to it to email to the customer. Padloper passes the new customer details, new user details and the temporary password set to the new user to the partial template 'customer-registration-request-email-content-html.php'. Devs can then use that information to handle customer registration. When you add a customer, they get the role 'padloper-customer'. A customer linked to a ProcessWire user is a 'registered customer'. In this case, the $customer->userID equals $user->id and $customer->email is $user->email. Currently, in case you had existing users in your shop that were customers prior to Padloper 009, Padloper does not currently link those users to the customers. You can do this via the API. If you change a 'linked' user's email, the email of the corresponding customer will also be changed to keep them in sync. The same thing happens if you edit the email of a linked (registered) customer; the corresponding user's email will also be amended. If you delete a ProcessWire user linked to a Padloper customer, the customer will be delinked, i.e. will no longer be a registered customer and $customer->userID will be 0. If you delete a registered Padloper customer, the corresponding ProcessWire user will also be deleted. It is possible to email a customer directly from the admin. A customer can have multiple addresses. These can be of types: Primary Shipping Shipping Primary Billing Billing A customer can only have one Primary Shipping and one Primary Billing address. The 'customer view' page allows you to see the details of the last 10 orders of the customer and the total of all their orders to date. With the customers feature, you can pre-populate address details of logged-in customers for a better checkout experience. You can also use this feature to build customer dashboards, address books, etc. as @alexm points out here. Currently, there is no dedicated API to retrieve, amend, etc. a customer. This is planned. For now, you can get a customer as follows: <?php namespace ProcessWire; $email = "mario@blaze.br"; $customer = $padloper->get("template=customer, customer.email={$email}"); if(!$customer instanceof NullPage){ // CUSTOMER FOUND /** @var WireData $customerBasics */ $customerBasics = $customer->padloper_customer; /** @var WireArray $customerAddresses */ $customerAddresses = $customer->padloper_customer_addresses; bd($customer, __METHOD__ . ': $customer - at line #' . __LINE__); bd($customerBasics, __METHOD__ . ': $customerBasics - at line #' . __LINE__); bdb($customerAddresses, __METHOD__ . ': $customerAddresses - at line #' . __LINE__); } Customer Groups You can add/remove this optional feature at any time via ‘/admin/shop/configure-padloper/’. This feature requires the 'Customers' feature. The Customer Groups feature allows you to segment your customers using certain criteria. The segmentation allows you to target specific customers for various purposes including marketing, loyalty services, discounts, statistical analysis, bulk emailing, etc. You will need to implement such actions per your needs, e.g. via an addon, etc. A customer can belong to more than one Customer Group. You can create unlimited Customer Groups. Currently, you need to manually create Customer Groups and add them to Customers. However, in future, you will be able to: Use a GUI query builder to create a customer group then apply it to matching customers. For instance, a Customer Group named 'Europe High' with the criteria "order > 500, country = Italy|Switzerland" Automatically add a Customer to a Customer Group if they meet the criteria. E.g., if a customer places an order and the customer's order totals becomes greater than >= 500 and the customer country is Italy or Switzerland, Padloper will automatically add them to the above 'Europe High' Customer Group. Screenshots
    1 point
  12. Hello @darkmesaia I often recommend these to start with: Important concepts: https://www.smashingmagazine.com/2016/07/the-aesthetic-of-non-opinionated-content-management-a-beginners-guide-to-processwire/ Understanding Processwire Templates, Fields and Pages: https://medium.com/@clsource/understanding-processwire-templates-fields-and-pages-201aecd0a1a4#.m9yquavll Step-by-step guide, 4 part tutorial: http://blog.mauriziobonani.com/processwire-basic-website-workflow-part-1/ Approaches to categorising site content:
    1 point
×
×
  • Create New...