-
Posts
10,902 -
Joined
-
Last visited
-
Days Won
349
Everything posted by adrian
-
Ok, I just tested your complete script and it works fine here. I submitted the form, followed the account confirmation email and it instantly logged me into that new account. I don't know what's happening on your server to stop it from working as expected. Do you have debug mode on / Tracy installed?
-
If you are bootstrapping I am guessing this is an ajax call, or a site that is trying access PW data but without using PW template files? In this case, $input->urlSegments won't work, because it's not a PW template file. But in general, you can use any PW variable in a bootstrapped scenario normally, eg $page, $fields, $session - no need for $wire or wire()
-
I just tested your exact code and it worked here. The only exception being that I defined the two session vars at the top. $session->dapassword = 'abc123456789'; $session->username = 'testuser'; $dauser = new User(); $dauser->pass = $session->dapassword; $dauser->name = $session->username; $dauser->save(); try { echo "<br><h1>dauser[name] is </h1>".$dauser->name; // echo "<br><h1>dauser[pass] is </h1>".$dauser->pass; echo "<br><h1>session[name] is </h1>".$session->name; echo "<br><h1>session[dapassword] is </h1>".$session->dapassword; $task = $session->login($session->username, $session->dapassword); //use plaintext password if (!$task){ $notice = "Failed to login to your newly created user. Contact technical support."; } } catch(\Exception $e) { throw new WireException('Unable to login as user'); } The only confusing thing is that you try to echo $session->name rather than $session->username so that it returned blank, but it logs me into the new user correctly. Out of curiosity, does forceLogin() work?
-
Yeah, for fatal errors you need to look at: register_shutdown_function To be honest I was confused, because for me undefined functions are exceptions, not fatal errors. I just read that "php7 has changed this behavior, and undefined functions/methods are catchable exceptions." Some more on this change: "Many fatal and recoverable fatal errors have been converted to exceptions in PHP 7. These error exceptions inherit from the Error class, which itself implements the Throwable interface (the new base interface all exceptions inherit)." http://php.net/manual/en/migration70.incompatible.php
-
I think it's simply a matter of the order of things. Without the pageNameCharset being set in config, the first call to the pageNameUTF8() sanitizer method is after init(), but when you set it, it must call that sanitizer method before Tracy has loaded. I did ask Ryan a long while back about the possibility of being able to load Tracy earlier - he said he might be amenable, but nothing ever came of it. I just did some experiments loading the Tracy core files in the root index.php and with that setup, your bd() call still works, even with: $config->pageNameCharset = 'UTF8'; I'd like to revisit this idea with Ryan - I have come across bd() undefined many times when trying to use them in the PW core files - it would be great to have Tracy loaded before anything else. I wonder if a request for this might be more powerful initiated by someone other than myself?
-
Pretty quiet on that dev version, so I have decided to merge those changes into Master - please review the ReadMe for changes to the API and also visit the module settings to see everything new. And of course let me know if you find any problems. PS I also have a new version in the wings that adds JSON import. I feel like it should be expanded to also allow JSON export, but maybe these additions should retire this module and have a new one named TableImportExport (without the CSV part).
-
I hate Inkscape - if you don't have Illustrator, take a look at Gravit Designer: https://designer.io/ There are web-based and desktop versions available.
-
I haven't tried, but you should be able to extract the code from that Hanna code and add it to your template file in the sidebar, which now that I scroll back up this post looks to be what @Pixrael did. You should be able to use that function in your sidebar.
- 14 replies
-
- table of content
- anchor
-
(and 1 more)
Tagged with:
-
Maybe I don't fully understand the term headless, but I would have thought that PW is ALWAYS headless, even with our typical way of using the API. Surely headless doesn't just mean delivery via JSON etc, but rather simply no forced output. I have used PW in the "regular" way for websites, but also as a JSON source for SPA web apps and mobile apps. In my mind, these are all headless, but maybe I I still don't get it, or maybe that is actually what you are saying anyway
-
Hi @mel47 - you are correct that repeaters aren't supported. I do support some other multi-value fields, but repeaters are more than multi-value, they are also multi-item (if that makes sense) which is where it gets complicated because not everyone will want the export to be formatted the same way. Just to clarify - you are wanting BCE to export your repeater items, rather than import a CSV of items into a repeater field? I see in your example how you want the export to look but the problem is that different child pages can have different numbers of items in their repeater fields which will mess up the CSV export - nothing will line up properly. This will be especially bad if you have "Column Labels" turned on. I am just not sure that there is a good universal way to export repeaters to CSV. If someone comes up with one, then I will happily implement, but otherwise, I think it's going to be a bit of a mess. That said, I have just committed a new version that fixes quite a lot of CSV export bugs! It also includes my experiments with Repeater support. They are commented out though, so you will need to uncomment: https://github.com/adrianbj/BatchChildEditor/blob/ca338ff0cb6f784579a370ff5e5f2fb71c3eeb85/ProcessChildrenCsvExport.module#L144-L154 https://github.com/adrianbj/BatchChildEditor/blob/ca338ff0cb6f784579a370ff5e5f2fb71c3eeb85/ProcessChildrenCsvExport.module#L196-L205 and then comment out these: https://github.com/adrianbj/BatchChildEditor/blob/ca338ff0cb6f784579a370ff5e5f2fb71c3eeb85/ProcessChildrenCsvExport.module#L177 https://github.com/adrianbj/BatchChildEditor/blob/ca338ff0cb6f784579a370ff5e5f2fb71c3eeb85/ProcessChildrenCsvExport.module#L128
-
Yep, that fixes it - thanks!
-
Thanks @tpr - great having the sticky header. Another one of those File Compiler annoyances that needs a to fix: Add links to configure admin theme settings on Profile \ProcessWire\page(SuperUser only)
-
I like the idea of unicode icons, but I am also not convinced that browser support is that consistent. I have seen screenshots of the Tracy console for example where the history back/forward icons don't look good. Also, I agree that there aren't enough options for our needs. Something like a fontello custom set might be ok, but in general I have always thought that plain SVG icons were lighter, so I think I'd prefer to go with those I think. I wonder how much this really matters - is it over-optimization to be worrying about this?
-
Beautiful work @SamC ! I look forward to reading through all the tuts sometime soon. For the lazy amongst us, here is the link: https://www.pwtuts.com I am glad you are using it, but sad that you don't think you are using it properly. Do you think there are some things I can do to make it easier to understand/use? Maybe we need a tut for it
-
@helmut2509 - it's working fine here. Are you actually calling the function where the "number" session value is set before you try echoing it?
-
Yeah - I got it and appreciate your tip! Just thought others might like clarification on how it works with multiple templates.
-
All sounds great @szabesz The other possibility here is to use FontAwesome icons as much as possible. I recently added it for loading the icons for the new "Custom Links" section in the PW Info panel. Although it is only loaded if you have defined some custom links. Because you guys can add a link to any page (admin Process or frontend) on the site, this was the only way to show the appropriate icon automatically. Not sure if this is a better or worse approach in terms of resources. Obviously Fontawesome isn't super lightweight, but it's also not embedding the SVG directly into the panels, so maybe more efficient? Sounds like a good idea - I'll sort that out.
-
Like any other ProcessWire variable, the easiest way to access them inside a function is: wire('session')
-
Just for reference: https://processwire.com/talk/topic/10408-button-labels-for-pagetable/ I thought I remembered this being possible by default, but turns out it only works when you have more than one possible template.
-
I like where you are headed with this and I think the new version looks nice. The only thing I wonder is whether it is worth re-crafting all the icons vs just running them through SVGO (which I should really have already done). I just used the online GUI for this test. I just tried and it reduced it to 501 characters: <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 44.8 44.8"> <g fill="#CD1818"> <path d="M22.4 21.2c2 0 4-1.8 4-4V4c0-2-2-3.8-4-3.8s-4 1.7-4 3.8v13.5c0 2 2 4 4 4z"/> <path d="M30.7 3.3c-.5-.2-1 0-1.4.2-.5.3-.7.7-.7 1.3v5c0 .6.3 1.2.7 1.4 4.2 2.4 7 7 7 12 0 7.7-6.2 14-14 14-7.6 0-13.8-6.3-13.8-14 0-5 3-9.6 7-12 .4-.2.7-.8.7-1.3V4.4c0-.6-.2-1-.7-1.3C15 3 14.5 3 14 3 6.6 6.6 1 14 1 23c0 12.3 9.7 22 21.6 22 12 0 21.6-9.6 21.6-21.6 0-9-5.4-16.6-13.3-20z"/> </g> </svg> So there is definitely significant room for improvement with these icons. It's just a question of whether it's worth going the "line only" route, or just using SVGO to optimize the existing ones. Honestly I think most of the icons could do with some work - many of them are pretty ugly If you feel like taking this on, it would definitely be appreciated. Anyone else have any thoughts?
-
Possible to add an "select" text option to a template select at the top?
adrian replied to Juergen's topic in General Support
Oh yeah, I agree it can be very useful. I have just managed to avoid the need so far, but your enhancement would make it much more functional and less prone to being ignored thereby creating problems. Maybe add a request in the appropriate Github requests repo? -
Possible to add an "select" text option to a template select at the top?
adrian replied to Juergen's topic in General Support
@Juergen - nice work. I actually wonder if perhaps this should be the default behavior for this. I almost never allow editors to choose a template for child pages, but with this approach I might be more willing to do so in the future. Should this be a request to Ryan? -
A quick update. Thanks to lots of help from @szabesz we have fixed the issue with the Config Data section in PW Info panel from being slow. The latest version also: 1) Fixes a ERR_BLOCKED_BY_XSS_AUDITOR browser error if there are <script> tags in your template file and you are using the Template Editor panel to test code changes. 2) Adds a new option for opening links from the PW Info panel in a new browser tab (off by default) - this was requested by @szabesz above. 3) Revamped the init() and ready() code so that much less code is processed when Tracy is completely or temporarily disabled. It also improves efficiency for various conditional checks. 4) Several other minor tweaks / fixes. Please let me know if you come across any problems with this new version.
-
I didn't know they were called that - awesome! Only 6 weeks to go ... BTW - actually not that big of a Star Wars nerd
-
Sorry, my fault - you don't want to echo $content in loginform.php - you just want to set it - it needs to be echo'd in main.php if you want the login form to appear with your site html wrapper content. Is this site online somewhere I could take a look?