Leaderboard
Popular Content
Showing content with the highest reputation on 11/03/2021 in all areas
-
@horstbeat me to it ?. Two options: Option 1: substr() https://www.php.net/releases/8.0/en.php (+ trim() only if needed) edit. <?php namespace ProcessWire; $originalString = '01 - Category1'; // will remove the space after 01 - for you as well $str = substr($originalString, 5); // debug // d($str,'substr'); Option 2: array explode() + trim() <?php namespace ProcessWire; $originalString = '01 - Category1'; // explode the string on the hyphen ('-') // this creates an array $str2Array = explode("-",$originalString); // our string is in the second position // we get it and remove spaces on each side $str2 = trim($str2Array[1]); // debug // d($str2Array,'$str2Array'); // d($str2,'str2');2 points
-
The PHP function substr() can be used to start after the 4. character. You can use it in your template file or create a little textformatter module. (Sorry im on mobile, no link to the PHP manual provided.)2 points
-
This feature was added lately ? Docs can be found here: https://processwire.com/blog/posts/pw-3.0.181-hello/2 points
-
Hi @Zahari M. - I spent a fair bit of time on this last night without any success. It's due to AdminActions adding the videos via the API which requires hooking into Pagefiles::install rather than InputfieldFile::fileAdded which is what the module uses when adding a video the normal way. I thought this would actually be fairly simple, but I couldn't get the hook to fire - not sure if I was just being dumb, or if there is something I need to do differently because this is a Fieldtype/Inputfield module - something I haven't actually done much with. I'll try to take another look, but honestly not sure when I'm afraid as I don't have much time at the moment. Sorry about that.2 points
-
Hi all, I have posted this in the VIP support forum of Padloper as well. Some of you do not have access to that board so posting here as well. Hopefully it doesn't count as spamming?! In June 2018, Antti announced that he was looking for a new product owner for Padloper. Sometime after, I had a fruitful discussion with him about my vision for the project if I was to take over. We agreed that commitment, motivation and a concrete plan were all important ingredients for the continued success of Padloper. I would like to officially announce that I am now the product owner and lead developer of Padloper. For those who may not know, I am the author and maintainer of several ProcessWire modules, both free and commercial. I am also a moderator in the ProcessWire forums. I would like to share with you a number of things regarding what’s going to happen next. This will be a long read. First, I would like to thank Antti for developing a great product. A lot of man-hours, dedication, passion and love has gone into making Padloper what it is today. Secondly, I would like to thank all users of Padloper. A great product is nothing without active users utilising it, putting it to the test, reporting bugs (even offering possible solutions) and proposing new features. So, thank you for helping make Padloper great! Support Thousands of hours have gone into developing Padloper. Although the code is well-written and easy to follow, Padloper is a big application with many moving parts. As such, it will take some time before I can fully grasp its inner workings. To make this transition as smooth as possible, Antti will help me with support for Padloper for some time. Currently, Padloper has a dedicated support forum. This is an arrangement between Ryan and Antti. The support forum works great as it allows the opening of multiple support threads to cover different issues. I have yet to speak to Ryan whether this arrangement can continue. However, given that I have other pro modules that I support in the open forums, it is unlikely that I will be requesting Ryan to let Padloper’s dedicated forum carry forth. A dedicated forum for one of my pro modules and open forums for my other pro modules will lead to confusion and questions from users of those other modules. Hence, Padloper support in the forums will move to the open forums. The disadvantage here is obviously the fact that support will be offered in one single (and maybe massive) support thread. To get around a ‘single thread support forum’, I am thinking of developing a simple online support queue system for all my modules. Meanwhile, support will continue in a new single thread and via email. Roadmap This list is neither exhaustive nor cast in stone. Its aim is to give an overview of my plans for Padloper. · Padloper 2 – a new major release · New backend for Padloper · Optional pro frontend module for Padloper · Documentation · New payment modules Let’s talk a bit about this list. Padloper 2 Release Padloper 2 will be a major release that incorporates a new, central backend shop for Padloper. This will be a new process module that pulls from the existing parts of Padloper (data models, etc) into one interface (more on this below). This version will also be extensible in the frontend, allowing for the plugging in of a new, optional, commercial frontend shop (full featured shop profile). Padloper 2 will not support the current ‘any page can be a product’ paradigm. Technically, products will still be pages. However, all products will utilise the same Padloper template. These will be invisible to the shop users themselves (e.g., hidden in admin tree). Only superusers will have full control of the Padloper system stuff. Support The current Padloper will continue to be supported until the new Padloper 2 is released. New features will be included in Padloper 2 only. Once Padloper 2 is released, legacy Padloper will only receive security fixes. All other support will cease. Upgrade There will be no upgrade path from the current Padloper to Padloper 2. Although their underlying architecture is the same, making sure that everything works in different setups and environments will be time consuming. However, for those who really need to migrate, if time allows and for an agreed fee, I could develop a custom script for the migration. Backend A new backend interface will be the major visual difference between the existing Padloper and Padloper 2. It goes beyond visual differences though. The new backend will be the single gateway for managing all shop-related features, both current and new ones. The backend will unify and include: · Easily add shop products. · Ability to add as little or as many custom fields to products as required (title, SKU, price, discount field, image/photo, description, categories, tags, etc). · Discounts manager (including auto start/expire discount codes). · Customers manager. · Invoices manager. · Taxes management. · Payment gateways manager. · Improved digital products management. · Stock management. · Manual order creation. · Graphical sales report. · Customer support. · Access-controlled shop editors/staff. · Dashboard for shop metrics. · Shop settings. · Product variations. · Import/export products as CSV or JSON. · Products search/filter. · Etc. Users will be able to turn off backend features that they do not need. This will enable a more streamlined experience for users. I plan to release Padloper 2 within 4 - 6 months, hopefully sooner. This is a major undertaking, hence the timescale. Please note that the first release of Padloper 2 will not include all of the above planned features. The idea is to build incrementally, adding new features in minor updates, focusing on stability, usability and security. Frontend Past requests have included the development of a full featured frontend shop. This is planned for Padloper 2. However, this will be an optional pro module priced separately from Padloper itself. The ability to build own frontend shops using Padloper API will still continue. For those who want a plug-n-play solution, this frontend shop will come in handy. The frontend shop profile will feature an ajax-powered shopping cart and a customisable ready-to-go theme. Pricing Model There are no plans to change the current prices of the 3 Padloper licences (Single, Developer and Agency). However, in order to continue to provide Padloper as a stable product with great features, it is also important that it remains a competitive and financially sustainable project. In order for this to happen and to also bring Padloper in line with my existing pro modules, the pricing model itself has to change. Starting from Padloper 2, the pricing model will shift to an ‘annual subscription’ model rather than the current ‘lifetime licence model’. I am fully aware that there are different opinions for and against annual subscriptions. However, I believe that this model is the most equitable approach that suits both the developer and the clients. The annual subscription will allow users (licence holders) to get 12 months of free VIP support for Padloper as well as future updates available within that time period. After the 12 months, users will be able to renew (online) their subscription at a discounted cost (worked as a fraction of the full purchase price) for a further 12 months (perpetually). Users will be able to continue to use Padloper for life even if they don’t renew their subscriptions. Upgrading current licences to Padloper 2 will be a paid upgrade. Current users of Padloper will get an attractive discount. This will be a time-limited offer (maybe a couple of months) that will start with the release of Padloper 2. New customers will pay the full price for Padloper 2. I hope the planned features are reason enough for you to consider upgrading to Padloper 2. Payment Modules I will be taking over as the maintainer and lead developer of the existing payment gateways (Payment base class, PayPal and Stripe). New payment modules are also planned. Payment modules will continue to be free. However, only ProcessWire 3+ support will be provided going forward. Padloper Domain and Future Downloads I have also taken charge of the Padloper domain. Within the next 12 months, purchase and download of Padloper will shift to processwireshop.pw. Please note that this is not the official shop for ProcessWire! It just bears a name that reflects its product offerings ?. Eventually, traffic to padloper.pw will redirect to processwireshop.pw. Feedback I would love to hear your thoughts about the upcoming changes and any feature requests you might have for Padloper 2. Whilst I cannot guarantee that any request will be implemented, I can promise that I will thoughtfully consider all feedback. Thanks for reading and thank you for supporting Padloper! kongondo1 point
-
The following video demonstrates how to set up a development server that is 100% ProcessWire friendly and uses all the latest software (PHP 8, MySQL 8, Apache 2). While there are other approaches to it (such as using tasksel lamp), the video demonstrates an efficient and clean way in getting all the latest versions of the software, advanced configuration settings, in addition to setting up SSL. This could also be used for WSL2 since it's ultimately a barebone virtual machine, much like DigitalOcean and similar providers.1 point
-
I don't think this is right. My runtime Fieldtype is based off Ryan's Concatenate Fieldtype and that does not create a DB table. See also his comments in the code, e.g. this one. No database table is necessary.1 point
-
@kongondo Thank you. Thas was one point. The other point was, that i saved the page, not the repeater itself. Now it works: $r = $this->pages->get("/test/")->test_repeater->find(1043)->first(); $r->setStatus(1); $r->save();1 point
-
Also you can use owner selector like template=tag, tags.owner.template=post, limit=10 Where 'tags' is your page reference field used in blog post template and 'post' is the name of this template.1 point
-
This feature was added lately ? Docs can be found here: https://processwire.com/blog/posts/pw-3.0.181-hello/1 point
-
Yet another one with some basic PrivacyWire markup to make it slightly more GDPR/DSGVO-compatible... at least you need an opt-in for the video. !HannaCode:rumblePrivacyWire:eyJuYW1lIjoicnVtYmxlUHJpdmFjeVdpcmUiLCJ0eXBlIjoyLCJjb2RlIjoiXC8qaGNfYXR0clxudmlkZW9pZD1cInZscG9pNlwiXG5oY19hdHRyKlwvXG48P3BocCBuYW1lc3BhY2UgUHJvY2Vzc1dpcmU7ID8+XG5cbjxzY3JpcHQgdHlwZT1cInRleHRcL3BsYWluXCIgZGF0YS10eXBlPVwidGV4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b2lkOyA/PlwifSk7PFwvc2NyaXB0PiJ9/!HannaCode It doesn't render anything unless you opt-in for external media (cookies).1 point
-
$import_timestamp = time(); foreach($jsonData as $jsonDataItem) { // Search for the page $imported_page = $pages->findOne("template=import_page, title=$jsonDataItem->name"); // Check if the page exist if ($imported_page->id) { // update values $imported_page->setAndSave([ 'field_A' => $jsonDataItem->source_A, 'field_B' => $jsonDataItem->source_B, 'field_C' => $jsonDataItem->source_C ]); } else { // create new page $p = new Page(); $p->template = 'import_page'; $p->parent = $pages->get(xxxx); $p->title = $jsonDataItem->name; $p->save(); } } // use this because if the pages were not updated/created during this import it means they don't come in the json $old_imported_pages = $pages->findMany("template=import_page, modified<$import_timestamp"); // hide/delete all $old_imported_pages..1 point
-
Ladies and gentlemen. You have been waiting for a very long time. I am happy to say we are almost there. I am fixing a few loose ends in readiness for the launch. I will create a new thread outlining the way forward with alpha (early beta) testing later this week (barring any show stoppers) or next week at the latest. Thanks.1 point
-
You'll probably find what you need under "How to force pages to sort by their admin order with $pages->find()" on https://processwire.com/docs/selectors/ If that doesn't help, you may need to loop through the pages (or set up a sort field, but that'd most likely be greatly over complicated).1 point
-
AppApiFile adds the /file endpoint to the AppApi routes definition. Makes it possible to query files via the api. This module relies on the base module AppApi, which must be installed before AppApiFile can do its work. Features You can access all files that are uploaded at any ProcessWire page. Call api/file/route/in/pagetree?file=test.jpg to access a page via its route in the page tree. Alternatively you can call api/file/4242?file=test.jpg (e.g.,) to access a page by its id. The module will make sure that the page is accessible by the active user. The GET-param "file" defines the basename of the file which you want to get. The following GET-params (optional) can be used to manipulate an image: width height maxwidth maxheight cropX cropY Use GET-Param format=base64 to receive the file in base64 format.1 point
-
Free access to Flutter Apprentice from October 6, 2021 through January 6, 2022. https://flutter.dev/apprentice-giveaway1 point
-
You can find plenty of great free resources on the web to learn PHP but I think @wbmnfktr is right that some kind of upfront investment (either time and/or money) in learning the basics of PHP will help you a lot for working with ProcessWire ? 15 min: https://www.youtube.com/watch?v=ZdP0KM49IVk 5 hours: https://www.youtube.com/watch?v=OK_JCtrrv-c1 point
-
Sorry for interrupting the usual programm and topic here but... @franciccio-ITALIANO maybe you want to look up a mentor/tutor here that helps you to maintain and build ProcessWire sites from either the ground up or even to maintain already built sites. I know you from your past questions, requests and and posts in several other topics. As much as I want to see someone helping you... the more I think you need someone that's guiding you from the basics of PHP to the basics and fundamentals of ProcessWire to the state you can work out ProcessWire sites from each and every state and upwards. So... my questions for our awesome community is... who can help and assist @franciccio-ITALIANO to get to a state where he is able to maintain a basic ProcessWire-website? Native italian speakers (is this even the correct way to write this?) go ahead... and let us know. If there is noone who can assist... let me know @franciccio-ITALIANO... I'll put time aside to guide and assist you in some kind but in english. ;)1 point
-
1 point
-
Ok. 1. We need to generate a unique token for a user and store it. The simple way to do that is to add a field to user page (login_token in the example). To make process easier we make a method for that via hook: // site/init.php $wire->addHook("User()::getToken", function(HookEvent $event) { $page = $event->object; if (empty($page->login_token)) { $page->of(false); $page->login_token = generateToken(12); $page->save(); $page->of(true); } return $event->return = $page->login_token; }); The genereateToken() function is yours to implement as you wish. 2. Now we can generate a link: $link = $page->httpUrl . "?user=". $user->id . "&token=". $user->getToken(); 3. Finally we need to handle those parameters and make user autologin: // site/templates/_init.php if ($userToLoginId = $sanitizer->int($input->get->user)) { $url = $page->url; $userToLogin = $users->get($userToLoginId); $tokenToLoginWith = $sanitizer->text($input->get->token); if ($userToLogin->id && $tokenToLoginWith && strcmp($userToLogin->login_token, $tokenToLoginWith) == 0) { $loggedInUser = $session->forceLogin($userToLogin); if ($loggedInUser) { $user = $loggedInUser; }; $session->redirect($url); } } We can then nullify user token if we want it to be only a one-time ticket. I rewrote whole lot of stuff, so might not work straight away, but surely you can fix it @szabesz)) Hope I am not missing something essential.1 point