modifiedcontent
Members-
Posts
286 -
Joined
-
Last visited
Everything posted by modifiedcontent
-
Create quick and simple event RSVP form?
modifiedcontent replied to modifiedcontent's topic in API & Templates
Thank you for all your responses. kongondo's response in particular was really helpful in focusing my attention. szabesz, I have been working on a front-end user registration system as well, have been following that thread: I am now trying to wrap my head around the basics of forms in PW; a generic form, just getting some data submitted to a database. Isn't Soma's thread/example mostly about rendering the form through the API, input fields etc., not so much about how the data gets processed? If it is possible to just use a plain html form in a template, I'd like to start there. The main thing I need to understand today is how to process the data from the form, how to get it into the database via PW. I'll follow up when I have tried some things... Ryan gave a very clear explanation of how to work with the database in Processwire: BTW, apologies for my dumb questions. I also use these threads to keep track of my own "research" and hopefully that will help others in the same situation. -
Create quick and simple event RSVP form?
modifiedcontent replied to modifiedcontent's topic in API & Templates
Thanks for the response Adrian. I was trying to follow that thread, all nine pages, and completely lost the plot. That's why I posted my question. If I want a form of one field, to add a name to a guest list/database, what would that look like in PW? Do I need a module or can I use core features? Should I create a Page with Children first as a database where the data from the field can be stored? Is there an example or explanation anywhere that is more step-by-step? Soma's thread - from 2012, five years old! - start presupposing that you know lots of stuff already. I don't know formbuilder etc. - I see it is a $180 pro module, is forms really that complicated in PW? Soma's thread is more like a theoretical discussion between coders. This thread has some starting points: I guess this module could be modified to serve as an RSVP form: http://modules.processwire.com/modules/newsletter-subscription/ Someone also had a probably usable code suggestion for this in 2012, with feedback from Ryan: -
I need to figure out how to make a simple front end event registration/RSVP; enter full name + email address for the guest list (database), receive an email confirmation. Where to start with this? I know how a regular html form works. What does a basic Processwire form look like?
-
Module FrontendUser: login, logout and register users / members
modifiedcontent replied to pwFoo's topic in Modules/Plugins
@Jozsef, I have that line in my full code: So I guess it's in the wrong place? I'll try it with a few things turned around and report back... Edit: Moved the line to current position. Fullname is still blank after the validation email. Will dig into the documentation when I have time and report back... What does '// Call hook after field is processed by PW form api' do? I thought that bit added fullname to userObj. Should I replace mySanitizedCustomInput with 'fullname' or 'field' or something else? Which hookable events are there; processInput, save, ...? Is 'send email validation code' another hookable event? To be clear, the fullname does get saved fine, but only after manually entering it again after the email validation. Fullname is not saved along with the username before the validation process or is not added to the custom field in the pre-filled form. Or is that the normal process? -
Module FrontendUser: login, logout and register users / members
modifiedcontent replied to pwFoo's topic in Modules/Plugins
@pwFoo, I have followed the documentation. I don't know how to use forms API, hooks, basic PW features. This is the first PW module I'm working with after spending years on Wordpress. -
Module FrontendUser: login, logout and register users / members
modifiedcontent replied to pwFoo's topic in Modules/Plugins
I don't understand hooks or/and how the forms API works. I am trying to fix this bit: The fullname apparently does not get saved along with the username when the validation email is sent; the pre-filled form only has the username. I tried changing $fullname->addHookAfter to addHookBefore, but that made no difference. I assume the $fullname->addHookAfter function adds the fullname field value to a userObj object, so that it gets saved along with the username and email address in $fu->addHookBefore ... , right? Or is 'send email validation code' another hookable event than 'save'? Is there a list of available hookable events in the registration process? Or are custom fields like fullname correctly stored with the userObj by this bit of code, only not automatically added to the pre-filled form by the module? Should I hook into the validation email event, somehow, and add the fullname field? Or are my assumptions about what goes on in this bit of code all wrong? -
Module FrontendUser: login, logout and register users / members
modifiedcontent replied to pwFoo's topic in Modules/Plugins
@pwFoo, could you give a few more pointers how to do that? This 'do it with a PW hook' is still not obvious to me at all. Is there a code example somewhere? If it is possible to have a registration process with just email, that would be great. I'd like to avoid javascript - good point @jmartsch. -
Module FrontendUser: login, logout and register users / members
modifiedcontent replied to pwFoo's topic in Modules/Plugins
@jmartsch, actually go without a username entirely would probably require a rewrite of this module and maybe PW core itself. I am trying to get rid of the username field by autogenerating a username based on the full name input and then make the username field hidden; there is still a username, but only for internal system purposes. I use this javascript: -
The problem was in the javascript. $("#username").text(input); ... should be ... $("#username").val(input); ... and then it works fine. Nothing to do with Forms API. Any way to delete this thread?
-
Thanks for the response. The id's of the PW input fields are exactly the same as the html test fields; 'fullname' and 'username'. The alternative first line breaks the javascript.
-
Module FrontendUser: login, logout and register users / members
modifiedcontent replied to pwFoo's topic in Modules/Plugins
Yes, I get that. I have a custom fullname field, but can't find anywhere how to store that value and how that works in combination with your module. PW features and hookable etc. may be completely obvious to you, but this is the first PW module I am working with. I had added the fullname field to the template. Should I also add a username field to the template? Or does the module take care of that? There is this error log in admin: Error: Exception: Method FrontendUser::fullnameRegister does not exist or is not callable in this context (in /home/mysitepath/wire/core/Wire.php line 410) -
Module FrontendUser: login, logout and register users / members
modifiedcontent replied to pwFoo's topic in Modules/Plugins
I can't figure out the forms API and hookable etc. I only have very rudimentary PHP knowledge. I had copied and pasted this together to get a custom realname/fullname field: But the fullname field is not stored. How do you store custom fields with userObj? I can't find any clear code examples anywhere that don't go off into a million different directions. Should I add something under $fu->addHookBefore, like $user->fullname or something like that? What is fhValue($field->name)? What "name" is that? Is that the username? I tried it changed to $field->fullname, but that didn't do anything. Adding a new user apparently looks something like this: So I guess I have to define fullname "somewhere" using $form->get('fullname')->value? I have no idea what the module does and what I am supposed to code together myself and how it is all supposed to hang together. Completely lost. Getting this ready for "production" is starting to take way too long. -
I am trying to apply onkeyup or jquery keyup to a PW form - to autogenerate a username from a real name. This javascript/jquery works fine on test html input fields: But I can't get it to work on the fields generated by the PW forms API, even though the input id names are exactly the same. What am I missing?
-
Module FrontendUser: login, logout and register users / members
modifiedcontent replied to pwFoo's topic in Modules/Plugins
Does the module provide a way to autogenerate the username from a real name - firstname + lastname? -
Module FrontendUser: login, logout and register users / members
modifiedcontent replied to pwFoo's topic in Modules/Plugins
I want to generate the username from a real/full name; firstname + lastname. How can I get onkeyup into the fullname input field? This didn't work: $fullname = $modules->get('InputfieldText'); $fullname->label = 'Full name'; $fullname->attr('id+name','fullname'); $fullname->required = 1; $fullname->onkeyup='generateusername()'; Question now asked here with the username autogenerating javascript included. -
Troubleshoot/test sending email from PW
modifiedcontent replied to modifiedcontent's topic in General Support
Thank you for your responses tpr, szabesz and Robin S! My problem was caused by unrelated server config issues, but I'll leave this thread here. I am trying to understand the basics of sending from PW. The registration script sends from 'processwire@mywebdomain.com'. Where is that sender address set in PW? It is not the admin's email address. Is there an email setup config somewhere in admin? -
I am working on a registration script here. It used to work and send an email with a validation code to a new user. But it has stopped working. Nothing gets sent. How can I troubleshoot this? This is the bit that is supposed to send the email: I tried replacing wireMail() with mail(). That had no effect. A php contact form in a Wordpress site on the same server/hosting account still works. It could still be something in the email setup on my server, but I have no idea where to start. Is there a quick test to see if sending email from PW works?
-
Module FrontendUser: login, logout and register users / members
modifiedcontent replied to pwFoo's topic in Modules/Plugins
Trying to add firstname, lastname fields now. Here is what I have so far, following an earlier post suggested by flydev: This sort of works, but the firstname is not filled in when you click on the email validation link; the user has to manually add it again. It should be stored along with the username, right? Is 'addHookAfter ...' the wrong hook? Is it essentially the same problem netcarver posted about here? Will I have to add the same lines like the $firstname stuff for each custom field or is there a way to consolidate that, process all custom fields with one function? -
Why does the forms API use lists - ul, li - to style forms? It makes them much harder to control with CSS. Why not something like this? <style> .field { float: left; width: 100%; } .inputfieldheader { float: left; width: 100%; } .input { float: left; } </style> <form> <div class=field> <label class=inputfieldheader>Field one</label> <input class=input> </div> <div class=field> <label class=inputfieldheader>Field two</label> <input class=input> </div> <div class=field> <label class=inputfieldheader>Field three</label> <input class=input> </div> </form>
-
Module FrontendUser: login, logout and register users / members
modifiedcontent replied to pwFoo's topic in Modules/Plugins
Yes, that helps a lot, especially the addHookAfter bit for the confirmation email. Thanks flydev & pwFoo! Below is my one page working version, as a minumum starting point: Any suggestions for improvements? Is that log out link the cleanest way to do it? -
Module FrontendUser: login, logout and register users / members
modifiedcontent replied to pwFoo's topic in Modules/Plugins
Thanks pwFoo. I guess I could use this and this as guides then? They are from 2011... I don't see anything about nickname (?) or Firstname Lastname in the frontenduser repo wiki. What is the hook for new user registered successful? I can't find it here searching on 'register' or 'registration' or 'user'. Has anyone implemented a welcome/confirmation email with FrontendUser? -
Module FrontendUser: login, logout and register users / members
modifiedcontent replied to pwFoo's topic in Modules/Plugins
Great! The basic process now works without errors. Since this is the first Processwire module I am working with, I am still very confused how to finish this. I need to figure out the following: 1. What happens after the user has registered, with the email validation code added to the form? There is no second 'Welcome' email with instructions for the user. Or instead of a confirmation/welcome email you could put a message on the screen after registering: 'Thank you for registering. You can now log in with the username and the password you just picked.' Or log them in automatically after registering. But most users will probably expect a Welcome/confirmation email. 2. How can I assign a role to users upon registration? I have added a custom role "member". 3. How can I add fields to the form, starting with Firstname Lastname? Can Processwire's users db table(s) be extended and used to store entire user accounts - address, phone number, rss feed, favorite color, hobbies, spirit animal, ...? 4. How can I style the form, including the html, not just using the CSS classes/ids? I want to get rid of the listing tags li etc. Would there be a way to just hardcode a form in the template instead of generating it with fu->register()? 5. How can I change the text/style of the validation email? Probably add a template file somewhere? The answers to this are probably to be found in PW documentation and elsewhere on the forum. Any pointers in the right direction would help. -
Module FrontendUser: login, logout and register users / members
modifiedcontent replied to pwFoo's topic in Modules/Plugins
I also get a fatal internal server error with FrontendUserRegisterEmailValidation.module in PW 3.0.33: Line 160 in my case, not 110. Line 160 is: Removing that line "fixes" the error, shows the form. Removing everything from the arrow as well. If you try to register, an email gets sent, but it is empty. Changing 'true' to 'false' had no effect. A combination of flydev's solution for line 110 + removing everything from the -> sign, does seem to fix the error. An email does get sent with a validation token. And then the user has to pick a password? And then what? Is there supposed to be a second email, with 'Welcome, now log in here ...'? Or should I structure the form/pages in such a way that picking a password also logs the user in? Is there really no complete working implementation example somewhere? I tried 'check for updates' on the FrontendUserRegisterEmailValidation.module , but get Once you have a working process, how would you style and extend the forms? Beyond using the available classes and ids for CSS. Is there a way to get control over the html? I never use list tags, <li etc., for forms. I'd like to rewrite it to something like this: <div><input placeholder="label text here" ... /></div> -
Module FrontendUser: login, logout and register users / members
modifiedcontent replied to pwFoo's topic in Modules/Plugins
Thanks pwFoo. Is there a complete basic working code example anywhere? This is what I have so far: <?php $fu = $modules->get('FrontendUser'); $redirectDestination = htmlentities($_SERVER['REQUEST_URI']); if ($user->isGuest()) { $fu->register(); $fu->process($redirectDestination); echo $fu->render(); echo 'or log in here if you already have an account'; echo $fu->login(null, $redirectDestination); // with default fields } if($user->isLoggedin()) { if (isset($_GET['logout'])) $fu->logout($redirectDestination); echo "<a href='?logout'>Logout</a>"; } ?> Login/logout works fine. Registration adds a new user, but the user would never know; I need to figure out how to send him/her an email confirmation, with an activation link maybe (?), log them in automatically, ..., what else? I also don't want my registration form to ask for a "username"; only real name - firstname, lastname - and email address and then later maybe addition info. I'll probably end up generating a username from the real name in the background, as I've always done in Wordpress. All these points have probably been discussed somewhere in this long thread, but is there any place where it is all put together into one working example? The documentation gives the basic functions/usage (?) but not how to put it together, leaving out essential points that may be obvious for regular Processwire users, but not if this is the first PW module you try to implement after years in WP world. The code snippets/examples then skip ahead to sanitizing and custom fields. I can't find anywhere how to add an activation link email process. Email activation is mentioned here, but mixed in with a lot of other issues. Where should I start? -
Module FrontendUser: login, logout and register users / members
modifiedcontent replied to pwFoo's topic in Modules/Plugins
Thanks pwFoo. Following the documentation I assumed there was a default $redirectDestination somewhere, like "SELF" - would that be '$_SERVER['PHP_SELF']' or '$_SERVER['REQUEST_URI']' or is there a PW specific way to do that? What does 'return $this' do in your empty($redirect) test?