Macrura Posted October 19, 2012 Share Posted October 19, 2012 I'm trying to determine if i can build a site for a client using PW; this client has requested a site for a homeowner's association; - members only site - front-end user login (about 70 users) - when users login they will be able to -view a list of announcements, and a list of events - submit an event (planning to use the formbuilder, post to 'events' page) - submit an announcement (formbuilder -> page) after reading many posts on the forum, it seems that this can be done without a tremendous amount of code (also thanks to the formbuilder); the area i'm not sure about is having users be able to edit a submission, or their own user data; so if they submit an event or announcement, how to have them be able to edit it, on the front-end once they are logged in, and also how to enable them to have access to their user data (i.e. to change username, password or other fields); TIA, marc Link to comment Share on other sites More sharing options...
renobird Posted October 19, 2012 Share Posted October 19, 2012 Hi Marc, If you save the events/announcements submissions to PW pages, then you have complete access to the API and can build a front-end editor for user to be able to edit their submissions. Ryan posted this is the form builder forums as a way to save which user submitted a form. You could do this with JS, but if it's user data, you might want to protect it from tampering by setting it from the PHP side after the form is submitted (but before its saved). You could do this with a hook. Paste this into the top of your form-builder.php template file, or it could be done from a module if you prefer. $forms->addHookBefore('FormBuilderProcessor::saveForm', null, 'hookSaveForm'); function hookSaveForm(HookEvent $event) { $form = $event->arguments[0]; $field = $form->get('some_field'); if(!$field) return; // probably not the right form if that field isn't here $field->attr('value', 'the value you want it to have'); } You can access the User pages from the API, just like any other page, so creating a front-end profile editor is fairly straight forward. I can post more detail here later if you need a place to start. 1 Link to comment Share on other sites More sharing options...
Macrura Posted October 19, 2012 Author Share Posted October 19, 2012 Thanks a lot Tom! I did look at that post, so thanks for reminding me about that; I guess i'm just going to go for it with PW; the client want's something uber-simple and minimal; the users of this system will be mostly 65+ and i'm wary of doing it with one of the big three, since it's always so hard to hit the target exactly with those pre-built components/plugins... I'll see how far i can get and post back here. -marc 1 Link to comment Share on other sites More sharing options...
ryan Posted October 19, 2012 Share Posted October 19, 2012 Form Builder isn't currently setup to modify existing entries. It's also not a page editor like what you have in the PW admin. When a form entry is saved, it goes into a database kind of like a CSV file. Then the entry from that database can optionally be imported to a page. This can happen automatically too, but that's what's happening behind the scenes. So there isn't actually any direct form-to-page capability beyond that. This is great for creating pages, but not modifying existing ones (at least, not yet). The capability you are talking about is pretty similar to what we're doing on the modules.processwire.com submission form. You can submit a module through there, and you can also edit any existing module. You have to have the email address and password that you originally submitted the module with in order to change it. It seems to be working out quite well. I'll be happy to send you the code for it if you'd like. It's not using Form Builder at present, though I will probably upgrade it to use Form Builder at some point. Link to comment Share on other sites More sharing options...
Macrura Posted October 20, 2012 Author Share Posted October 20, 2012 Thanks Ryan for your input on this and for the offer of the code. I'm still considering alternative options for this, and it's sort of low-budget and then need it soon, so i may end up having to go with a prebuilt system; I'll get in touch if/when that option looks necessary.... -marc Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now