Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/02/2020 in all areas

  1. ProcessWire Dashboard Download You can find the latest release on Github. Documentation Check out the documentation to get started. This is where you'll find information about included panel types and configuration options. Custom Panels The goal was to make it simple to create custom panels. The easiest way to do that is to use the panel type template and have it render a file in your templates folder. This might be enough for 80% of all use cases. For anything more complex (FormBuilder submissions? Comments? Live chat?), you can add new panel types by creating modules that extend the DashboardPanel base class. Check out the documentation on custom panels or take a look at the HelloWorld panel to get started. I'm happy to merge any user-created modules into the main repo if they might be useful to more than a few people. Roadmap Panel types Google Analytics Draft At a glance / Page counter 404s Layout options Render multiple tabs per panel Chart panel load chart data from JS file (currently passed as PHP array)
    9 points
  2. I'm digging this thread out because I just came across the same problem in my module. I fixed it for now by merging the default config as suggested by @Robin S: $options = $this->modules->getModuleConfigData($this); $defaults = (new TextformatterPageTitleLinksConfig())->getDefaults(); $options = array_merge($defaults, $options); See the complete source code here. However, I agree that this should be handled by ProcessWire. I expected getModuleConfigData to return the final merged configuration, the method doesn't suggest that it only retrieves the config that has been saved to the database. This way the method creates a temporary dead zone between installing a module and saving the module configuration page, where errors can pop up in the meantime. @horst @kongondo By the way, saving the module config during installation may not be sufficient. In my case, I got an error when I upgraded my module to version 3.0.0 which included a new setting. So even though the module was already installed and the options had been saved before, the new version was missing the new configuration option as it wasn't included in the configuration returned by getModuleConfigData. So with this approach one may also need to hook into the upgrade process to make sure the configuration is saved after every update.
    3 points
  3. I think the best would be to create a custom process module. You can assign a permission to that module so that only some of your users can view this pages in the backend. This page could be a 100% custom UI with a list of all pending users and a button for each of them that adds the role to that user when clicked. class Process extends Process { public static function getModuleInfo() { return [ 'title' => '', 'version' => '0.0.1', 'summary' => '', 'icon' => '', 'requires' => [], 'installs' => [], // name of permission required of users to execute this Process (optional) 'permission' => 'foo', // permissions that you want automatically installed/uninstalled with this module (name => description) 'permissions' => ['foo' => 'May run the foo module'], // page that you want created to execute this module 'page' => [ 'name' => 'helloworld', 'parent' => 'setup', 'title' => 'Hello World' ], // optional extra navigation that appears in admin // if you change this, you'll need to a Modules > Refresh to see changes 'nav' => [ [ 'url' => '', 'label' => 'Hello', 'icon' => 'smile-o', ],[ 'url' => 'something/', 'label' => 'Something', 'icon' => 'beer', ], ] ]; } public function init() { parent::init(); // always remember to call the parent init } /** * */ public function execute() { $this->headline('Manage users'); $this->browserTitle('Manage users'); /** @var InputfieldForm $form */ $form = $this->modules->get('InputfieldForm'); $form->add([ 'type' => 'markup', 'label' => 'foo', 'value' => $this->usersTable(), ]); return $form->render(); } /** * Render users table */ public function usersTable() { $users = $this->pages->find('...'); $out = '<table>'; foreach($users as $user) { $button = "<a href='./activateUser/?id=" . $user->id . "'>activate</a>"; $out .= "<tr><td>{$user->name}</td><td>$button</td></tr>"; } $out .= "</table>"; return $out; } /** * Activate user and redirect to overview */ public function executeActivateUser() { // get user $user = $this->pages->get($this->input->get('id', 'int')); // !!!! caution !!!! // check if user is really a user and if the current user is really allowed // to modify this user! if(!$access) throw new WireException("no access"); // otherwise add role to user $user->of(false); $user->addRole(...); $user->save(); // redirect to overview $this->session->redirect("./"); } }
    3 points
  4. I will soon implement the file upload to custom folder feature into ImageReference. Then you can upload an image from within the inputfield to a designated folder and then pick it afterwards. This should make it an even better option for SettingsFactory.
    2 points
  5. Hi @Macrura, just tried your module and have some suggestions: This is the screen after installation: What do you think of adding this section in the instructions field? https://github.com/outflux3/SettingsFactory#instructions (or at least the link) You could even add a direct link to create a new page under ADMIN (.../page/add/?parent_id=2) or under SETUP (.../page/add/?parent_id=22). Maybe you also want to add this screenshot for anybody wanting to get a quick impression of how this module looks in action (using the kitchen-sink example file): Looks like I should start using your modules for my projects! ? Thx! How do you handle file uploads? Eg site logo, favicon, image placeholder, invoice template etc? Maybe we get a possibility soon: https://processwire.com/talk/topic/22815-new-post-weekly-update-for-27-dec-2019/?do=findComment&comment=195465
    2 points
  6. Happy New Year to everybody! New v.2.0.1 is out. It fixes the problem described by @LMD. Now the inputfield can be used inside repeaters again. Also I removed the option to load thumbnails via ajax. It didn't really make sense to have this as an option. They are now always loaded via xhr requests. I did extensive testing with 2 fields of this type on one template and a repeater field on the same template, that also holds the 2 fields of this type and it went smoothly. However, if you experience any problems, please let me know here or on github. Thank you.
    2 points
  7. This is the new topic for the Settings Factory module (formerly known as Settings Train). Repo: https://github.com/outflux3/SettingsFactory I'm not sure what versions this is compatible with, it has only been tested on 3.x branch; it is not namespaced, and i'm not sure if namespacing is necessary or a benefit for this module; if any namespace or module gurus can weigh in on this, let me know. I'm also not sure if there needs to be a minimum php version; I have one live site using this now and it's working great; But before submitting to mods directory, would be better if there was some additional testing by other users.
    1 point
  8. New showcase entry, for Aaron Copland, composer. https://www.aaroncopland.com/ Features Filterable/Searchable Works Listing with category, publisher, instrument, tag, keyword, or year range filtering Each work has a page showing meta data, as well as related media like audio, images, video, and related events & news. Works are cross related at various levels, as Copland would sometimes use sections of one work in other works Microdata (json-ld) for site, person, works, images, news and some events Ability to display embedded media like Spotify, Youtube/Vimeo, Getty Images, Archive.org etc. Fast autocomplete site & works search Modules used Admin Custom Files AOS Page Field Edit Links Auto Smush Batch Child Editor Custom Inputfield Dependencies Admin Comments* Secure Files Font Awesome Pro Import External Images Autocomplete for CK Editor Inputfield Selectize Simple MDE Visual Page Selector Font Icon Picker Page Field Info Page Table Extra Actions Pages 2 PDF Changelog Dashboards Process Documentation Settings Factory Restrict Tab View Selectize Template & Field Tags Prev/Next Tabs Text Input Awesomplete Get Video Thumbnails Ion Rangeslider Runtime Markup Config Form Inputfield Color Inputfield Field Descriptions Extended Cookie Management Banner ProCache Lister Pro Profields (Table mostly) FormBuilder Various custom modules *Admin Comments is a module in development that enables site admins/editors/managers to add comments to pages in the backend and to optionally notify other site admins/editors/managers. Possibly to be released in directory soon.
    1 point
  9. Merry Christmas/Happy Holidays and Happy New Year! This week we take a look at two new modules released this week: LoginRegisterPro and FileValidatorImage. Plus discussion of upcoming plans for new FileValidator modules and how they are useful in PW. Then a brief highlight of two great new ProcessWire-powered websites— https://processwire.com/blog/posts/new-modules-and-great-websites/
    1 point
  10. OH MY GOODNESS !! This thing is a beauty !!! Well done sir.
    1 point
  11. There's more than one way to skin a cat. Anyway the current version fixes it as well, just in a different way.
    1 point
  12. I just upgraded TD, and now I see this Tracy error on every page (FE + BE): I've deleted the assets/cache/ folder several times, refreshed modules etc., but the error persists. I don't know if it matters, but I've upgraded Tracy with Module Toolkit (only discovered and used for 1-2 days, and so far working flawlessly). Other infos: ProcessWire: 3.0.147 PHP: 7.2.19 Webserver: Apache/2.4.35 (Win64) OpenSSL/1.1.1b MySQL: 5.7.24
    1 point
  13. Just in case you haven't come across this site before: https://caniuse.com/#search=webp
    1 point
  14. @MilenKo Just a minor issue that caught my eyes: I would "cache" the webp support in eg. config.php so it shouldn't be evaluated on each function call: $config->isWebpSupported = strpos($_SERVER['HTTP_ACCEPT'], 'image/webp') !== false; if($config->isWebpSupported) { // ... or use a static variable inside the function to evaluate only once: function webp_support($imgURL) { static $isWebpSupported = strpos($_SERVER['HTTP_ACCEPT'], 'image/webp') !== false; if($isWebpSupported) { // ... } else { // ... } } Note that I used "!== false" because if "image/webp" is at the beginning, the strpos gives 0, and it's false (not sure if it can be at 0 position, but it's a good practice to use like this imo). (untested, haven't written PHP for months :))
    1 point
  15. Haven't used it yet, but I think I read that Mystique is also a good module for this kind of stuff. I have also used SettingsFactory and can say that it works great.
    1 point
  16. Here is the complete code - now with working simulated "readonly" InputfieldSelect:
    1 point
  17. Hello to all mighty people and Happy New decade start. Wish you all the greatest goodness, joy and happiness. Well, and a lot of great code as well ? I've implemented WEBP images to optimize my soon to be released profile and by a lucky coincidence I discovered on my Mac that no images are showing when using the Safari. I thought that Apple would have embraced the idea by now when several other browsers have already done that but it seemed like I was wrong. I tested the .htaccess approach, however I could not make it working under Safari, so I decided to add a little function to my _functions.php: //WEBP Image Support function webp_support($imgURL) { // Check if the browser headers contain image/webp support if(strpos($_SERVER['HTTP_ACCEPT'], 'image/webp')) { // If yes, use the webp image url return $imgURL->webp; } else { //Else, show the original image url return $imgURL; } } After that, in every image call I do the following: <?php $img = $page->images->first // Call for the image location $image = webp_support($img->size(100,100)) // Used to size an image and convert it to WEBP //Image call in the markup echo "<img src='{$image->url}' alt='{$image->description}' >"; That seems to be working fine and show the WEBP format on Chrome, Opera and Firefox under MacOS/Windows/Linux but show the original image version under Safari. I did not test with the Windows version of Safari since it is a long time not updated version and it won't make much sense to support the newer format anyway. My question for you is if there is a simpler approach than my current to show WEBP images to the supported browsers and fallback to original If not?
    1 point
  18. @bernhard, many thanks for trying out the module, and for your suggestions and feedback! I will see about implementing the suggestions, especially linking to the Github and Forum topics for anyone who installs it, so that it is easier to grasp how to use it. I'm also hoping to test out the ImageReference field within this and then post example screenshots showing an even more kitchen sink setup, with images etc. Not directly related to your post, but responding more to the general consensus on where and how to create settings pages: I found this module to be most useful in the past couple of years for things like: - Site Schema for a person or business (the fields basically follow the schema.org items; See screenshots below) - Settings for various custom implementations - e.g. api keys, urls, enable/disable features, etc. -- on one site we use this to enable the site manager to choose which comment system to use (Disqus, Facebook etc), and then put in various settings if using Disqus (user id etc) - Theme settings, like you might find on a WordPress theme, stuff like colors, what type of global footer to use, logo selections (using page refs), site title, slogan. It is also a good way to have settings for any custom code you are doing without having to write a module...
    1 point
  19. Forget the above, it is indeed working. Sorry @adrian!! ?New Year same me.
    1 point
  20. Sorry, I can't seem to duplicate that issue at the moment. I am testing with tracy-all-dev permission with no existing tracy-home-dev permission and looking at the home page and it's showing the home-dev.php template. Maybe you can give me access to the new site to take another look?
    1 point
  21. @ryan SettingsFactory would be another example of how useful a file upload inputfield that is not connected to a pw page could be :
    1 point
  22. @Vigilante That's exactly where (the often overlooked) Pro field "Functional Fields" shines. It does exactly what you are looking for. https://processwire.com/blog/posts/functional-fields/ Or you could use the Textareas field: https://processwire.com/store/pro-fields/textareas/ The big advantage is that no matter how many fields you are using, behind the scenes it always just counts as one single field.
    1 point
  23. I think this might help you https://processwire.com/api/ref/functions/#pwapi-methods-Functions-API
    1 point
  24. @ is not supported in PHP only in comments and sometimes PHPDoc, however your IDE also uses that to resolve $config to a Config class for Intellisense purposes. Check this link for more information https://github.com/php-fig/fig-standards/blob/master/proposed/phpdoc.md
    1 point
  25. @ryan Are there any plans to include SSO features in LRP? e.g. allow a new user to sign up with his Github/Google/FB/Twitter... account? Single-sign-on registration / login can (at least in some use-cases) significantly optimize onboarding. I certainly wouldn't see it fit for new superusers, but for any other kind of custom-defined user-type, it would be a very cool feature to have. If there are currently no such plans, how complicated would it be to add SSO to LRP? Would it be possible with hooks?
    1 point
  26. I know this sounds super easy, and for one provider it sortof is. The issue might be that updating and keeping track of freight APIs for everyone would become a costly development project in itself. Might make more sense to provide API hooks that can be used to push to services like IFTTT or Zapier and see if they already have connectors to postal service APIs. Same goes for accounting bits. I know Xero has Zapier integration: https://zapier.com/apps/xero/integrations This whole vertical integrations issue is something X-Cart and CS-Cart struggled with for a long time, most clients in the meantime ended up opting to work with ShipStation if they had complex freight calculation requirements - they passed the freight on to a piece of software dedicated to the task. I think they had a tax tool integration also to handle various tax jurisdictions, etc. which is also fun. https://www.shipstation.com/developer-api/#/introduction/shipstation-api-requirements/server-responses or (as we ended up doing) doing direct integration because we had simple vertical distribution (FBA) and Amazon controlled the rates - which got a little more complicated once we needed to have separate FBA accounts for different regions, different inventory counts for different FBA accounts, and different shopping locales. To make things nuttier, CS-Cart recently added in warehousing which is let's you balance inventory between multiple freight locations: https://blog.cs-cart.com/2019/11/07/meet-cs-cart-4-11-1-with-warehouses-and-other-improvements/ I haven't gone through the nuts and bolts to see how box count, product distribution per box per order, warehouse location for boxes and freight accounts for warehouse locations all work together in a multi-vendor e-commerce package. I imagine it is trying to run a synchronized swimming routine with farm animals.
    1 point
  27. sure - i can definitely post a tutorial on how that is put together, will post soon..
    1 point
  28. I don't think it needs to be automatic, but perhaps the instructions could be expanded. Currently all they say is: "Create your processes then enter a path to the json or php definition of the fields in the path field." and that didn't initially make sense to me. I think spell it out: 1. Create a page under Admin (at the top level or under Setup if you prefer) 2. Save the page and then choose the ProcessSettingsFactory process from the dropdown. 3. Enter the path to youre settings file. Not sure using a placeholder is good the way you did - I actually thought it was already filled out with: settings/site-settings.php I also think you should say included "samples", not examples, because of the folder they are stored in. Hope that helps.
    1 point
  29. Hey @Macrura, I was surprised that the Process module didn't automatically create its own page, so I was a little lost for a minute or two, but otherwise looks great and looking forward to using it - thanks for the hard work!
    1 point
  30. I absolutely understand the position you are in. In my 20 years I saw a lot of CMS, switched because they took a wrong turn in development, or were overcomplicated. With PW I finally feel at home. Let me give you some advice in the steps you should take: Install PW locally with the intermediate profile Look at the templates, especially _main.php, _func.php and what's going on in there Then take a look at Selectors. Read for a while and play with them in your template Create new fields, add them to templates and use your new knowledge with selectors! Look at imagefields, text and textarea It won't take long untill your first Aha-experience! Play with the structure of your pages and adapt your selectors(select parents, parent->parent and children) Bookmark the Cheatsheet and look at it often It won't take long - believe me. And a whole new world of possibilities will open up to you! I have been there.
    1 point
  31. This works... $module_config = new MyModuleConfig(); $defaults = $module_config->getDefaults(); Does that look okay?? I'm an OOP noob.
    1 point
×
×
  • Create New...