Create a custom user edit form
Created 7 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
—
7 years ago
this seems interesting. I'll try it and give a feedback. thanks
frednwt
—
7 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.phpAnd then I made a
ProfileControllerwhich extendesAdminControllerinHttp/Controller/Admin:And then you need to create the
MembersFormBuilder.phpandMembersFormHandler.phpwhich might look like this:And
And then finally you can create your
admin.editview to render the form! Hah.It seems a bit crazy but it works a treat!