Create a custom user edit form
Created 6 years ago by dilusha100I need to allow my users to change/ update their user info ( first name, last name, ... etc) by a front end form ( without accessing to dashboard). So I tried to use {{ forms('user' , $user_id).get() }}
command in my twig file. But it is not working. So how to do that?
dilusha100
—
6 years ago
this seems interesting. I'll try it and give a feedback. thanks
frednwt
—
6 years ago
You can do all of this without a custom module. The twig form()
is highly customisable.
For example: https://pyrocms.com/help/developer-tools/form-builders/defining-custom-ajax-forms-in-twig
Hi @dilusha100!
I have solved this very problem but it’s a bit involved! Everything I have done is inside a custom addon.
First you can create some routes to do your profile viewing/editing from your
CustomAddonServiceProvider.php
And then I made a
ProfileController
which extendesAdminController
inHttp/Controller/Admin
:And then you need to create the
MembersFormBuilder.php
andMembersFormHandler.php
which might look like this:And
And then finally you can create your
admin.edit
view to render the form! Hah.It seems a bit crazy but it works a treat!