-
Posts
6,671 -
Joined
-
Last visited
-
Days Won
366
Everything posted by bernhard
-
Hm. There is no tracy-debugger permission. I created one and the console is still not there. I'm on www.t2p.test via laragon.
-
Hey @adrian sorry for this basic question, but what is the best/correct way to enable tracy for non-superusers on local dev? My settings now are these: But I cannot enable the console for my non-superuser?
-
Hey! I have a strange problem with a pagefield. As SuperUser everything works fine, but as "admin" I cannot select the "client" for a "training": The field is set to this: And the label field is "fullname". As SuperUser it just works fine: And the search also works (as admin): Any ideas?
-
How to catch PHP notice errors in AJAX requests?
bernhard replied to bernhard's topic in General Support
Hm... one of us does not understand ? I'm sending the request via ajax The server executes the request and it fails I get an AJAX error that breaks my batch-operation (that fires one request after each other) It should be like this: Send request Request fails, so return a valid json (eg "error": "error while trying to trash page xy") execute all following batches So what I want is to catch the error before the response is sent back to the client. -
How to catch PHP notice errors in AJAX requests?
bernhard replied to bernhard's topic in General Support
Thx, the problem is that this echo'ed output only appears when I do a var_dump($data); die(); above this block: https://github.com/BernhardBaumrock/FieldtypeRockGrid/blob/master/InputfieldRockGrid.module.php#L243-L252 Otherwise the response fails because it's not a valid JSON (because of the prepended error messages). I guess this is only in debug mode, but I'd really be interested how to catch (thx for the hint regarding the typo ? ) such errors. -
Hey everybody, hope you are doing fine! Today I had an error that was quite hard to debug... It was an AJAX request sent via RockGrid that should trash a page. It was working fine as superuser, but not for my client. So I thought it was related to access control. Then I did some hard var_dump() and die() in the AJAX and found the problem: Line 29/30 refer to a saveReady hook that obviously gets called when trashing the page. Somehow (don't know why, actually) the page has output formatting turned ON and the date conversion fails. No problem so far, a getUnformatted() solves this issue and I get a nice response: But I wonder how I could make the "response" more informative when something goes wrong. At the moment it just fails with an empty ajax response. Can I somehow "catch" the notice error? There is no Exception thrown. It's just an echo'ed warning. Thank you very much for your help! PS: The trash button code is simple, and you can see it here: https://github.com/BernhardBaumrock/FieldtypeRockGrid/blob/master/plugins/buttons/trash.php And it is invoked here: https://github.com/BernhardBaumrock/FieldtypeRockGrid/blob/master/InputfieldRockGrid.module.php#L223-L241
-
Better late than never ? ? You can use Pages::added for this: https://processwire.com/api/ref/pages/added/ And using conditional hooks (https://processwire.com/blog/posts/new-ajax-driven-inputs-conditional-hooks-template-family-settings-and-more/#new-conditional-hooks) it gets even easier and cleaner: $wire->addHookAfter('Pages::added', function(HookEvent $event) { $page = $event->arguments(0); bd($page); }); I always start with the basic hook and test it. In this case this was quite interesting, because it fired twice! The reason is that this page contains a repeater matrix that creates a page for the first (possible) item: Then you can modify the hook to be more specific: $wire->addHookAfter('Pages::added(template=basic-page)', function(HookEvent $event) { $page = $event->arguments(0); bd($page); }); Voila, it fires on the right page only: And it will not fire on any further publish/save/etc events ?
-
Cheers:) Would be nice to see a little tutorial when you manage to do it ?
-
I'd recommend using adrians great tracy debugger module. Then you can easily (and instantly) see the content of your variables. It has lots of helpful information so you'll learn a lot quicker and it has the console, where you can try out things quickly and easily. See what you get by a simple dump - using the short syntax d()
-
RockSkinUikit - Easily and quickly skin your AdminThemeUikit backend
bernhard replied to bernhard's topic in Modules/Plugins
Thanks for testing my module ? That's because the default Uikit theme's getUikitCss method is not hookable. I'm waiting for ryan to accept my PR... https://github.com/ryancramerdesign/AdminThemeUikit/pull/77 Would be nice if you could investigate more time to debug on this. I can't reproduce this, so I can't fix it. -
RockSkinUikit - Easily and quickly skin your AdminThemeUikit backend
bernhard replied to bernhard's topic in Modules/Plugins
Thanks for your help and for clarification. You said so I thought it has nothing to do with my module. Could you please provide a working PR for those changes? -
RockSkinUikit - Easily and quickly skin your AdminThemeUikit backend
bernhard replied to bernhard's topic in Modules/Plugins
Thanks for clarifying. That's why I don't like multi-site installations. There are always edge-cases where it doesn't work as expected... But this one might be worth an issue on github. -
Hi @tiefenbacher_bluetomato, thx for sharing! Do you have a demo for us where we can see it in action? ?
-
Great to hear that ? Thank you for your PR ?
-
Just merged a PR that takes care of camelCase fieldnames: https://github.com/BernhardBaumrock/RockFinder/pull/4/commits/c3bef03c5fc00b9439c0b6bba0997a5843f5868e @simonGG the filter might work, but it's for sure more efficient to do this via SQL. But if you don't have lots of entries it might be easier to stay with your solution.
-
Nice site! I like it ? You might want to fix this: ?
-
RockSkinUikit - Easily and quickly skin your AdminThemeUikit backend
bernhard replied to bernhard's topic in Modules/Plugins
Is your site a multi-instance installation? Why is it site-ncog and not just site? PS: Please try it with a fresh PW single installation and report if that works. If not, report the error. If yes, please try to debug what could be the problem with the other installation. -
RockSkinUikit - Easily and quickly skin your AdminThemeUikit backend
bernhard replied to bernhard's topic in Modules/Plugins
I guess this has nothing to do with my module. Where and how did you install AdminThemeUikit? -
RockSkinUikit - Easily and quickly skin your AdminThemeUikit backend
bernhard replied to bernhard's topic in Modules/Plugins
Yes, that's correct. -
Server change without backup of the database
bernhard replied to Junghanseaten's topic in General Support
You need the files AND the database for a working processwire installation, so if you don't have a database dump anywhere, you'll not be able to run pw. Maybe you have a dump in /site/assets/backups/database ? -
Hi Torsden, try to use ProcessPageEdit::buildForm, do a google search for this exact phrase and see if you can get examples. Sorry, on mobile ? The principle is to get the right field in the hook and then just change the "required" setting.
-
Glad to see you again, @Nvim! @Pete, are you also happy?
-
OR selectors should not be a problem. Could you please try to refresh all cached files? Maybe there's something else that causes this? Please try to narrow it down a little more... What's the array that is converted to string on line 195 of PageFinder.php ?
-
New version online: 1.1.2 The selector for the finder is now always stored as string, but can be retrieved as string or array - getSelectorStr() or getSelectorArr() This can be useful to share code for grids that are similar but need little adjustments, like one grid shows all available trainings, one grid shows only trainings that where booked by the current user: include(__DIR__.'/trainings.php'); $finder->setSelectorValue('client', $this->user); $finder->addField('done'); $this->setData($finder);
-
The new rockfinder updates make it easy to extend grids: Extending Grids Sometimes several RockGrids are very similar and you don't want to duplicate your code. You can create one base file and include this file from others: // trainings.php $finder = new RockFinder([ 'template' => 'training', 'sort' => 'from', ], [ 'first', 'from', 'to', ]); $finder->addField('coach', ['title']); $finder->addField('client', ['fullname']); // trainings_booked.php include(__DIR__.'/trainings.php'); $finder->setSelectorValue('client', $this->user); // only show trainings of current user $finder->addField('done'); // add column to show if the training was completed $this->setData($finder); You can then create another file, for example trainings_available.php to show all trainings that are in the future and available for booking: include(__DIR__.'/trainings.php'); $finder->setSelectorValue('from>', time()); $finder->setSelectorValue('client', null); // client must not be set -> means available for booking $this->setData($finder);