-
Posts
24 -
Joined
-
Last visited
Profile Information
-
Gender
Male
-
Location
Nottingham, UK
Recent Profile Visitors
1,733 profile views
applab's Achievements
-
module gets auto-installed if called from front-end?
applab replied to applab's topic in Module/Plugin Development
Thanks @kongondo, that is precisely the info I needed. Next time I'll RTFM a bit more before I post! -
module gets auto-installed if called from front-end?
applab replied to applab's topic in Module/Plugin Development
Hi @Zeka, Yes, I am using $modules->get("MyModule") in my front-end template. I was just surprised to see MyModule get installed as a result of that code rather than throwing an error, which is what I was expecting. I've achieved my original goal of preventing the install in that situation but I've realised that I still need to use isInstalled() in my front-end templates to avoid runtime errors so, thanks. -
applab started following GraphQL for ProcessWire , module gets auto-installed if called from front-end? , What's a good forum software that can integrate with PW? and 3 others
-
Hi All, I'm making my first serious foray into module development and I've discovered some behaviour which I found surprising... If I uninstall my module from the backend but do not delete the file, then I refresh a front-end page that is using that module, I would expect to see some kind of error but what happens is the module gets automatically re-installed. I can mitigate this behaviour by wrapping my front-end code in: if(modules()->isInstalled('MyModule')) { ... } but that doesn't seem like the best approach if the module is used in multiple places. Is there something I can add to my modules install() method to prevent it getting auto-installed in this situation? Thanks.
-
What's a good forum software that can integrate with PW?
applab replied to OrganizedFellow's topic in Dev Talk
Has anyone implemented Flarum yet? I like the look of it but I'm concerned that it seems to be in perpetual beta. My top contender at the moment is Vanilla but it's use of Smarty is putting me off. -
Yes, that makes a lot of sense, thanks.
-
My method is this... The user will register using their email address and never actually know the username that's used to log them in behind the scenes. On registration the username will be derived from the email address and if there's a clash I'll simply add an incremental numeric suffix. When the user comes to login, the username is looked up from the email address (which is, of course, unique) and it doesn't matter if a suffix has been added or not, as long as it's the right username for the email address.
-
I had a feeling that the failure of $session->login($email, $pswd); might be related to email sanitization, but since my solution worked I gave up pondering. Before trying it I didn't expect it to work as I thought that without a logged-in admin session I wouldn't have permission to query admin pages. But your solution of using a sanitized email as the username and then sanitizing $input->post->email before calling $session->login() also makes a lot of sense. I'll be doing the registration form next so I might adopt that approach.
-
Ok, I've found a workaround by using the email to lookup the user name and then logging in with that instead. $e = $input->post->email; $p = $input->post->pswd; $u = $pages->get("email={$e}")->name; $session->login($u, $p);
-
I have configured ProcessLogin to use email instead of username (and enforced unique values for the email field). I can login to my admin just fine using an email address but I'm trying to create a front-end login form and it's failing. I've copied the example from https://processwire.com/api/ref/session/login/ and replaced the two params with hard-coded values known to work for backend login but I just get 'Sorry Bob'. Anyone have pointers on how to get this working from the front end?
-
Make dashboard plugin page the default admin page
applab replied to kriegar's topic in General Support
Doh!, you are indeed correct. How did I miss that in the 2 line readme! Thanks. -
Make dashboard plugin page the default admin page
applab replied to kriegar's topic in General Support
The last time I used this module was on Dev 3.0.149 and it worked fine (in conjunction with your AdminCustomPages module). I've just installed on Dev 3.0.155 and it seems to be having no effect. Any ideas? -
applab changed their profile photo
-
Hi Sierra, It looks like you haven't disabled the 'automatic prepend/append' option for your template. Navigate to Setup->Templates->YourTemplate Go to the 'Files' tab and tick the two 'Disable automatic...' boxes. Does that fix it?
-
I'm still at the shallow end of the learning curve with Docker so I can't answer from experience but, AIUI... Yes, build a Docker image locally for your app/site and it should run seamlessly on any Docker-supporting host, which includes things like AWS. Regarding performance, according to this IBM research paper "The general result is that Docker is nearly identical to Native performance and faster than KVM in every category" http://domino.research.ibm.com/library/cyberdig.nsf/papers/0929052195DD819C85257D2300681E7B/$File/rc25482.pdf Just found this, it looks like others have made more progress
-
I'm a Linux guy end-to-end, but if I had to develop on a Windows machine my go-to solution would be to use https://www.virtualbox.org/ to setup a local Linux dev environment. I've also had a tinker with https://www.docker.com/ which looks like "the right way to go" but I don't it well enough yet.
-
Is It Possible To Add A 'comment' Programmatically?
applab replied to applab's topic in API & Templates
thanks Teppo, worked great after 1 amendment: on first attempt I got an error: "Error: Exception: Can't save field from page 1028: /blog/posts/test-post/: Call $page->setOutputFormatting(false) before getting/setting values that will be modified and saved." so, I did as the error suggested end ended up with: $comment = new Comment; $comment->text = "my text"; $comment->cite = "my name"; // etc. $p = $pages->get('/about/'); $p->setOutputFormatting(false); // added $p->comments->add($comment); $p->save('comments'); checking the PW cheatsheet for $page->setOutputFormatting() makes it clear why that's needed.