Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/09/2022 in all areas

  1. This last week my wife and daughter took a trip to NYC and it was my daughter's first time there. I was browsing around online looking at things they could do and so I visited the Guggenheim museum website to look into that option... I've always been a fan of the building, a Frank Lloyd Wright masterpiece. In addition to New York, I learned from the website that Guggenheim also has museums in Abu Dhabi, Bilbao and Venice, so I clicked through to view them as well. I really liked the Venice Guggenheim website, which had a much nicer website than the other locations. It was such a nice site that I was curious what they were running, so I viewed the source and... not WordPress (like the others), but ProcessWire. What a nice surprise. Then I was curious about who made such a nice site and there was a credits link in the bottom right corner that says the site was made by basili.co, nice work! It's always fun to come across a ProcessWire powered website randomly like that, and I thought you all would enjoy this one too. This week there are fairly minor updates on the core dev branch. Though the updates include one I've been meaning to do for a long time: improve the API for processing Inputfield forms. Previously there's been no way to check if a form is submitted, short of checking an $input variable yourself. Today I committed an update that adds a $form->isSubmitted() method that solves that, and more. It can identify which form was submitted, which submit button was used, and it also performs additional checks to make sure it's a valid submission before deciding that it's a form worth processing. It improves reliability, accuracy and security. Next week I'll be updating several of the admin forms to use it, among other updates. A few other useful helper methods were added to the Inputfield forms API as well. I realize that these updates may only be of interest to module authors, but I like keep you up-to-date with the week's updates either way. Thanks for reading and have a great weekend!
    13 points
  2. Thanks @AndZyk Trying this snip is also firing a 404. If I remove access management set in the template then I can get it to work. Taking your snip as an example I get this. It would just mean I would have to do access management within the PHP (e.g $u->isLoggedIn()) and not leave PW to it. However, that feels against the reasons for it being within PW. So the summarise, it seems this is an access issue and not a recognising role issue. Unless it's the access control not recognising the role. Who knows haha.
    2 points
  3. There was no sarcasm at all. I was just asking for more information to help everybody (being it me or robin or teppo or anybody else) to provide the best solution for his exact problem... That was all the information provided. And that's exactly what my hook does: markup in edit page. "I want to add markup+css+js easily to page edit. I want to add field markup to page edit and also lister etc...". That are obviously different things and maybe not as easy to do as with just adding one simple hook. You'd maybe need two. That was sarcasm ?
    2 points
  4. Thanks for the answer @szabesz! I've read the RuntimeMarkup module thread, and @kongondo also recommends to put the actual code in a file and just wireRenderFile() it. So that must be the main difference. I also thought about the easy inclusion of js and css in Runtime only as a substantial difference. By the way, I do not read any real sarcasm in @bernhard's post. I guess it is just a his style) He is always asking himself questions and answers them. Sort of inner dialog)
    2 points
  5. The biggest difference is that Robi's module uses php files while Kongondo's module saves the php code into the database so you need to code in the admin. I used them both, so I recommend Robi's module. I have already switched sites from Runtime Markup to Runtime Only. These are possibilities for sure (BWT, I do not think Ivan is afraid of writing code so why the sarcasm?), but what a simple buildFormContent hook will not do for us is being able to use the rendered output anywhere where an Inputfiled can be used (in a Lister or a ProField Table, etc, for example). So we are comparing apples to bananas if we compare inputfields to code running in hooks. ;) Both can be valid options, we decide what to use depending on the requirements, of course.
    2 points
  6. But role is a thing, and permissions is another and this last is what you are looking for. Look there - https://processwire.com/docs/user-access/permissions/ - and try to play with them, then give a look at those modules : https://processwire.com/modules/admin-restrict-page-tree/ https://processwire.com/modules/custom-admin-menus/ For example, I have a role "accountant" and he do not have access to the page tree or any other features than the "accounting" module.
    2 points
  7. I work every day with ProcessWire as 90% of our websites are built with it. We have a base install that we use for every new project, if anything from the weekly updates is an improvement on what we use in there, then we update our base install which will have the improvement on our next project. We also have a lot of retained clients who pay monthly to keep things running smoothly, again if there are any improvements in the weekly updates, we can slowly apply these to the retained projects going forward. The last major improvement in our workflow was the combo field which we use on all our latest projects, we wouldn't know about that if the weekly updates didn't exist. You mention being productive which I think is the best thing about ProcessWire. We have installs from years ago that are still running, and we don't have to worry about them, or care how they were built even if the client is not on a retainer, we just leave them. However, the client may come back and request some updates, we can start with running all the upgrades knowing that we have had very few issues in the past with just running upgrades, and we already know that behind the scenes there will be improvements in doing this, and improvements if we wish to use them with our coding. I guess what I am trying to say is you don't need to worry about the weekly updates if they don't have an impact on you, but the next time you check the documents you may see something that you can use as an improvement. I am sure nobody remembers all the improvements, I don't, nobody uses all of them, I don't, but they are there to use if you want and know about them. Everything still works with a site that you have already built if you just run an upgrade. There may be 51 weekly posts in a year I have no interest in, but 1 weekly post which is golden, I will take that for something I don't pay for (other than through the Pro modules). How does it make me learn coding, every day is a school day and seeing how things are done in ProcessWire makes me think in different ways when I am using other tools, I suppose that is what will happen when 90% of our websites are built with ProcessWire.
    2 points
  8. I have setup a starter kit for developing PW sites with Tailwind CSS. You can find it at https://github.com/gebeer/tailwind-css-webpack-processwire-starter I know, I'm a bit late to the party with Tailwind. In fact I only discovered it a couple of months ago and found it to be a very interesting concept. It took quite some time to get a pure webpack/postcss/tailwind setup that features live reloading dev server, cache busting, supports babel as well as autoprefixing and works well with PW. For the cache busting part I developed a small helper module that utilizes webpack.manifest.json to always load the assets with the correct file hashes for cache busting. No more timestamps, version numbers or the like required. The little helper can be found at https://github.com/gebeer/WebpackAssets Having used it for the first time in production on a client project I have to say that I really enjoy working with Tailwind. The concept of using utility classes only really convinced me after having put it to practice. During the work on the client project, some quirks with webpack-dev-server came to surface. I was able to solve them with the help of a colleague and now it is running quite stable in both Linux and Mac environments. I am fascinated by the fast build times compared to using webpack/gulp or gulp/sass. Also the small file size of the compiled CSS is remarkable compared to other frameworks. So this will be my goto setup whenever I am free to choose the frontend framework for a project. If anyone feels like they want to give it a try, I shall be happy to get your feedback
    1 point
  9. v0.0.3 fixes a bug experienced when saving page fields
    1 point
  10. Confirming that your snippet works fine here with LoginRegisterPro. But @Liam88 you have an issue, and if you are trying to debug/navigate to the url given by your $u->id link when there is no urlSegments, then you will end up on wrong user id, and then certainly on a random page ? // no urlSegment1 present // display links for user profiles? foreach($users->get('roles=login-register, sort=name') as $u) { echo "<li><a href='$u->id/'>$u->name</a></li>"; } $users->get() return a Page or null, so you are only getting iteration on the page's properties. You should use $users->find() to get the right $u page and his real id. Try with the correction and report back. And just a note: This method do not exist, it's isLoggedin(), with `Logged` and `in` in lowercase. Just in case to avoid future hassle ?
    1 point
  11. Indeed, there was a "No new pages for this template" checked ? Thanks!
    1 point
  12. Hello @Manaus, it should be possible to create new pages without a template file. Does this template or the parent template some special restrictions under the Family settings? Regards, Andreas
    1 point
  13. Thank you for explanation. This is working for me: <?php if ($input->urlSegment1) { $userID = $sanitizer->int($input->urlSegment1()); $u = $users->get($userID); if ($u->id) { if ($u->hasRole("login-register")) { echo $u->name; echo $u->email; } else { wire404(); } } else { wire404(); } } If you always get a 404 error, then maybe your ctype_digit check fails. Regards, Andreas
    1 point
  14. The new release (2.0.1) fix the publish and unpublish action.
    1 point
  15. v0.0.17 released - allows use of RockCalculator in magnitude fields. You need to install RockCalculator separately to enable this. It is entirely optional, but helpful:
    1 point
  16. Ok great thanks and that explains it.
    1 point
  17. this works fine: $modules->getModuleEditUrl($className);
    1 point
  18. Hello @ZAP, this may not be the answer you are looking for, but I would really consider your approach in making a website available for multiple domains. For search engines that could be considered duplicate content and for users it could be annoying, because f.e. they would have to approve the cookie consent again. I would recommend you to figure out what the default language and domain of your website should be (English or Portuguese) and then redirect the other domain to the language of the default domain (portuguese.org to english.org/pt/). The default language (in this case english.org) doesn't require a language URL (/en/). If you look at major companies like f.e. Apple, Adobe, Microsoft or Amazon that is how they handle it. If you really want to do this, you could look at this solution: Regards, Andreas
    1 point
  19. Yes, just create an admin page like shown in the link I posted above and in the add this method to your ProcessModule: <?php public function execute() { $this->wire->session->redirect('urlofyourmoduleconfig'); } So if someone clicks on the link in the menu pw will execute the execute() method which will cause the redirect to your destination.
    1 point
  20. I haven't been a regular user of the RuntimeMarkup module so I'm not qualified to talk about it. Maybe the best thing would be for you to try both modules and see which one suits you better.
    1 point
  21. Hi @bernhard. Had a quick look at this. It's a bit of a puzzle to me. The problem occurs when clicking the "Get Module Info" button on the new modules tab. I tried on 3.0.200 and 3.0.203 In 3.0.203, all I get is a compile error - see the title of this thread - so it's a bit difficult to diagnose as there is no obvious cause. This happens with RockCalculator and RockMigrations, but NOT RockFrontend. (Although I have not yet proceeded to install RockFrontend I have no reason to believe it won't install). In 3.0.200 I get the "ProcessWire: ProcessModule: No page specified" error. This is generated by ProcessPageEditImageSelect::init() (line 292 or 294). I have no idea why PW is even in that class. See the trace below Again, this happens with RockCalculator and RockMigrations, but not RockFrontend. I inserted a debug_backtrace - see here (unfortunately lost indents on paste from Tracy), which explains more: 3 => array 'file' => '.../admin/wire/core/Modules.php' 'line' => 1711 'function' => 'get' 'class' => 'ProcessWire\Modules' 'object' => ProcessWire\Modules count: 131 items: array 'type' => '->' 'args' => array 0 => 'ProcessPageEditImageSelect' 4 => array 'file' => '.../admin/wire/core/WireArray.php' 'line' => 1763 'function' => 'find' 'class' => 'ProcessWire\Modules' 'object' => ProcessWire\Modules count: 131 items: array 'type' => '->' 'args' => array 0 => 'installs=' 5 => array 'file' => '.../admin/wire/core/WireArray.php' 'line' => 582 'function' => 'findOne' 'class' => 'ProcessWire\WireArray' 'object' => ProcessWire\Modules count: 131 items: array 'type' => '->' 'args' => array 0 => 'installs=' 6 => array 'file' => '.../admin/wire/core/Modules.php' 'line' => 1911 'function' => 'get' 'class' => 'ProcessWire\WireArray' 'object' => ProcessWire\Modules count: 131 items: array 'type' => '->' 'args' => array 0 => 'installs=' 7 => array 'file' => '.../admin/wire/modules/Process/ProcessModule/ProcessModule.module' 'line' => 1154 'function' => 'isInstalled' 'class' => 'ProcessWire\Modules' 'object' => ProcessWire\Modules count: 131 items: array 'type' => '->' 'args' => array 0 => 'installs=' 8 => array 'file' => '.../admin/wire/core/Wire.php' 'line' => 420 'function' => '___buildDownloadConfirmForm' 'class' => 'ProcessWire\ProcessModule' 'object' => ProcessWire\ProcessModule #359 'type' => '->' 'args' => array 0 => array 'status' => 'success' 'id' => 2236 'class_name' => 'RockMigrations' 'name' => 'rock-migrations-1' 'title' => 'RockMigrations' 'summary' => 'The Ultimate Automation and Deployment-Tool for ProcessWire' 'version' => 121 'module_version' => '1.2.1' 'created' => 1661782531 'modified' => 1662318506 'refreshed' => 1662616138 'url' => 'https://processwire.com/modules/rock-migrations-1/' 'details_url' => 'https://modules.processwire.com/export-json/rock-migrations-1' 'requires' => array 0 => '' 1 => 'installs=' 'requires_versions' => array '' => array 'installs=' => array 'installs' => array 0 => '' 'author' => 'bernhard' 'icon' => '' 'likes' => 1 'release_state' => array 'id' => 1083 'name' => 'stable' 'title' => 'Stable' 'url' => 'https://modules.processwire.com/release-states/stable/' 'pw_versions' => array 0 => array 'categories' => array 0 => array 1 => array 'authors' => array 0 => array 'authors_other' => '' 'project_url' => 'https://github.com/baumrock/RockMigrations' 'download_url' => 'https://github.com/baumrock/RockMigrations/archive/main.zip' 'forum_url' => 'https://processwire.com/talk/topic/27504-rockmigrations-' 'author_id' => 2865 1 => false
    1 point
  22. I guess your question depends very much on your goals... Is your goal to not write any code? Is your goal to have a nice GUI? Is your goal to use as little 3rd party modules as possible? Because adding markup to the PW page editor is only a few lines of code, so you don't need any other module for it (untested): <?php // site/ready.php $wire->addHookAfter("ProcessPageEdit::buildFormContent", function($event) { $form = $event->return; $page = $event->object->getPage(); if($page->template != 'foo') return; $title = $form->get('title'); if(!$title) return; $f = $this->wire(new InputfieldMarkup()); $f->label = 'foo markup field'; $f->value = '<h1>i am a markup field</h1>'; $form->insertAfter($f, $title); });
    1 point
  23. Hello @Martinus, maybe findRaw() could simplify your solution: $a = $pages->findRaw("parent=/products/, seller=amazon, rating>0", "rating"); print_r ($a); // check array echo array_sum($a); // sum of all values in array Regards, Andreas
    1 point
  24. I'm using custom page classes a lot like modules. It's all about making things reusable to get more productive and to be able to increase quality step by step and not re-inventing the wheel from project to project...
    1 point
  25. Didn't think of using wire() - that would work. At least until you are using Multi-Instance. Or someone else uses it that uses your code ? And you still have to define the hooks as callbacks, which I don't like because of the reasons mentioned above.
    1 point
  26. Yeah it's hard to provide informations if you don't know who is watching... there might be total newcomers but some things might also be interesting for advanced users... Not sure how to tackle this... Hey @szabesz not sure what you tried, but I don't think that this can work. If you define a method as static you can't do object-related things inside this method. My IDE instantly throws an error: Static methods can be helpful for things like string-manipulations (eg Paths::normalizeSeparators()), but as soon as you need to work with objects (like pages and the wire object to attach hooks or such) you can't use static methods. I just did a little testing because having it defined static could have benefits, for example if there is no page created yet. In RockMigrations I solve that by creating a dummy page and saving it in the trash. Ugly but effective ? We could make the init static if we didn't use $this to attach the hook. But then we'd need to provide the wire instance as parameter (which is kind of clumsy imho). Also, we'd need to define the hook in a callback instead of placing it in a custom method of the pageclass (because we can't access the pageclass from a static method): So if we did all that, the init method would get quite bloated. Also I try to avoid defining hooks as callbacks, because they are harder to debug! See Tracy's "hooks triggered" section: That's the reasons why I put all the hooks in the pageclass's init() but make all of them a custom method in the class ?
    1 point
  27. Do you think it is better on the latest video? I didn't want to make it bigger... it feels so... strange ?
    1 point
  28. @maddmac glad the module still works ? It doesn't do anything except create new pages as per the criteria set in the module config. The new pages are simply pages - you can then query whatever you wish as normal. The module only has one method which adds a Hook Event after a page is saved.
    1 point
  29. I see, it's that simple! I did look at the docs (even that page), but I missed that part. Cheers.
    1 point
  30. Ok, I think the Profile-Exporter shouldn't include the values for the cache table, as mentioned in my post above. One of us should raise an issue on the modules github site.
    1 point
  31. Ok so I gave it a shot with creating a module by altering Ryan's code you linked to and this seems to be working so far (I think). Here's the module using that code teppo linked to, slightly modified to match my requirements: <?php /** * Edit Yours Only * */ class EditYoursOnly extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Edit Yours Only', 'version' => 1, 'summary' => 'Custom module to allow users only to edit pages they created. Applies to role \'standard\'', 'author' => 'Christina Holly, TinaciousDesign.com', 'singular' => true, 'autoload' => true, ); } public function init() { if($this->user->hasRole("standard")) $this->addHookAfter("Page::editable", $this, 'editable'); } public function editable(HookEvent $event) { // abort if no access if(!$event->return) return; $page = $event->object; // criteria required in order to edit if($this->user->name !== $page->createdUser->name) $event->return = false; } } If anyone sees any problems that this could cause, please let me know. So far it appears to be working as I want it but I haven't tested it thoroughly. Thanks!
    1 point
  32. Hm... Just had the idea that it would be nice to have the domain processwire.rocks for my channel with that name... My channel was created on 21.07.2022, the domain is taken by someone else and has been registered on 06.08.2022... coincidence? who.is leads to namesilo, which shows a "try to buy" button... https://www.namesilo.com/domain/search-domains?query=processwire.rocks that.sucks Any ideas for a better name + domain are welcome! I guess I'll have to register a domain BEFORE starting the next channel ?
    0 points
×
×
  • Create New...