How can one customize the general user account form using the user_edit template?
For instance, when enabling the node_edit template you are able to select the fields that you want to include on your node/%node/edit page. An example would be Variant->Content->Add Content(in a panel)->Form->Node Form Submit Button, or Field Form: My Custom Field.
This is very useful to "customize" the layout of the Node Edit page, because you are able to move input fields around and even put them in separate panes if you want. You also have access to many of the "General Form" fields.
However, when you are editing the user_edit template, you only have the option of "General Form." Moreover, if I do use a custom form field that has been defined in Configuration->Account Setting, I get an error in the Panels pages manager, and my custom field shows up as "Entity Info" on the front end.
Also, I'm a little confused why you have to pass the User object as a context to the user_edit template (you do not have to do this for the node_edit template)? If the template is taking over the path user/%user/edit, wouldn't the user be passed to the panel through the path? It seems that the node_edit and user_edit templates would be similar, but I'm sure they work a little differently.
If anyone could explain the difference and maybe give a suggestion that would be appreciated.
Comment | File | Size | Author |
---|---|---|---|
#22 | interdiff-1399058-18-22.txt | 1.73 KB | tnathanjames |
#5 | ctools_user_form_buttons-1399058-5.patch | 2.72 KB | floretan |
Comments
Comment #1
Letharion CreditAttribution: Letharion commentedI'm moving this issue over to the ctools queue, as the task-handlers such as user_edit are provided by Ctools, not Panels.
@auroraenterprise, please, re-phrase your question, and keep them one per issue unless they are very closely related. Afterwards, set the issue status to active.
Comment #2
tthenne CreditAttribution: tthenne commented@Letharion,
Sorry, my question seemed pretty ambiguous. I'm having difficulty with the user_edit template in pagemanager. What I have done is created custom fields in Home » Administration » Configuration » People » Account settings. I want to be able to pull those fields into my panels individually (which I have done with the node_edit template before -and that is what I was trying to describe above). However, what I'm running into is this...
First, I have to pass a User object as a contextual object just to get any type of Form option when I go to Add Content in my panels.
Secondly, it is just the general user_edit form and I'm not able to pick my custom form fields that I have defined in Home » Administration » Configuration » People » Account settings.
Hope I explained my questions better this time,
Troy
Comment #3
tthenne CreditAttribution: tthenne commentedShouldn't we be able to pick the parts of the form that we want to use when using the user/edit template for the Panels? This would be handy as you could display different form fields for different variants (which would let you select different form fields for different user permissions) or rearrange the form fields on the user/edit page to make it more appealing. As I explained above, you can do this with the node/edit template by going to Add Content -> Form -> My Custom Form Field. However, you cannot do this with the user/edit template.
Any comments for this?
Comment #4
Ashlar CreditAttribution: Ashlar commentedThis support request has not been active for over two months. In an effort to clean-up the issue queue this item has been closed. If all modules are up-dated and the request is still a concern please feel free to change the Status back to active.
Comment #5
floretan CreditAttribution: floretan commentedOverriding the user edit page without being able to add the submit button doesn't make much sense.
Here's a patch for a new ctools content type plugin based on the same functionality for the node edit forms, it's pretty straightforward. The binary part of the patch adds the icon for the plugin (it's reusing the "user" icon, just like the node_form_buttons plugin reuses the "node" icon).
Thanks to @jens.churchill for the collaboration on this functionality.
Comment #6
floretan CreditAttribution: floretan commentedComment #7
broeker CreditAttribution: broeker commentedPatch still applies on latest DEV and it would be great to roll this in -- we place the save buttons on every other edit form we override in the upper right so it makes sense to do so here also (and was confusing to users).
Comment #7.0
broeker CreditAttribution: broeker commentedEdit to initial post.
Comment #8
SilviaT CreditAttribution: SilviaT commentedSame problem here.
When I try to override the user edit form with page manager and I add some form fields from the user object I get the value "Entity info.", instead of the form field. Moreover, I cannot add the Submit button to the form.
Comment #9
paulbuk CreditAttribution: paulbuk commentedHey, don't know if this is too late, but I had been wrecking my head for weeks over trying to get data input 'forms' on my custom Panel Pages.
They seemed to show as available on some of the 'incode' templates but when I did my own 'custom' it never happened. UNTIL, I added a 'context' Node add form, then after saving and then back to the add 'Content' from the left page editor, a 'Form' option appeared was there, made my day!
Wished I had seen a tutorial on this weeks ago, I mean it's so easy, but not that obvious that you had to add 'Node add form' as a context.
Hope any future readers find this.
BTW, Submit Buttons are 'Actions' as a content (under Page Elements).
Good luck (-:
Comment #11
maximpodorov CreditAttribution: maximpodorov commentedThis is unusable until the user edit form context is available which can take placeholders.
Comment #12
tnathanjames CreditAttribution: tnathanjames at Mediacurrent commentedHere is a patch to enable users to add individual user edit form fields to the user profile edit page. I have added quite a few as individual components, but I have also added a general one: "User form: add a specific component" which allows adding fields that are placed on the default user form by a contrib module (ckeditor, password policy, ...).
The form actions / buttons pane also adds the hidden fields necessary for the form to properly submit (form_build_id, form_token, and form_id.
Hopefully this will help. It seems to work well for my purposes.
Comment #13
maximpodorov CreditAttribution: maximpodorov commentedThe patch file is incomplete.
Comment #14
joelpittetAs per #13
Comment #15
tnathanjames CreditAttribution: tnathanjames at Mediacurrent commentedSorry everyone. Leaving --name-only on the diff is no good :).
Here is the actual file.
Comment #16
tnathanjames CreditAttribution: tnathanjames at Mediacurrent commentedComment #17
joelpittetThanks @tnathanjames, glad you had it still on hand.
Comment #18
tnathanjames CreditAttribution: tnathanjames at Mediacurrent commentedUpdated an invalid comment after a peer review.
Comment #19
tmin CreditAttribution: tmin commentedI have reviewed the functionality of the patch and have 2 small comments:
1) It uses an icon that should be located in: ctools/plugins/content_types/user_form/icon_user_form.png which is not obviously part of the patch and generates a "broken image" view in the selection of the different form elements (I know it's minor but if it should be considered as a patch in ctools this should be solved)
2) In order to generate the "Current Password" field in the form (so that the user would have to fill in his current password in order to change his email or/and password) you need to select "User form: add a specific component" and then in the User form field select box select the account option. This is not a problem of the patch's implementation per se but a bit of documentation on how to generate it.
Other than these 2 small notes everything seems to be working perfectly (thanks so much for this patch btw).
I will keep testing it and after I have verified that all parts of the form work properly I will mark it as reviewed.
Comment #20
tmin CreditAttribution: tmin commentedAssuming that the above-mentioned .png file that is missing is replaced somehow, the core functionality of the patch seems absolutely fine.
Comment #21
Argus CreditAttribution: Argus as a volunteer commentedConfirming the patch in #18 is working fine. Tested all default fields, added some custom fields.
Comment #22
tnathanjames CreditAttribution: tnathanjames at Mediacurrent commentedI just found one more issue with this. The password update or email update for the current user requires the user to re-enter their password, but the current password form element was not being provided to the change password and change email plugin content types. The patch that I am attaching fixes that.
I am also including the binary for the icon in the new patch / interdiff. I just used --binary when creating the patch to get the icon in the patch. I hope that is the correct way to do that. If not, I am happy to update it and submit it again.
Comment #23
tnathanjames CreditAttribution: tnathanjames at Mediacurrent commentedComment #24
goldin CreditAttribution: goldin commentedFabulous. Thank you @tnathanjames for this. I am using the patch in #22.
However, the "User form: add a specific component" field does not seem to be working for me. For example, I have the Location module installed, which does add address fields to the default user form. But neither that field group nor the individual fields show up in the "user form field" dropdown in the "Configure new User form: add a specific component" popup window. The only fields that do show are the three hidden fields you list in #12.
Is there additional config that maybe I missed?
Comment #25
BYUStudies CreditAttribution: BYUStudies as a volunteer commentedThis patch is hugely helpful, thanks @tnathanjames!
We're setting up a custom user edit page with tabs - a page at user/%user/edit/addresses, another at user/%user/edit/orders, etc. The user edit forms provided by this patch are accessible on the default user/%user/edit page, but we can't access them with any of the other user edit pages we're creating. The forms aren't listed in the Add Content dialogue box.
Anybody have suggestions?
Comment #26
BYUStudies CreditAttribution: BYUStudies as a volunteer commentedFound the solution. We added the relationship: "User category edit form from user". Then on the field form settings where we had the choice between "User being edited" and "User category edit form from user" we changed it to the latter.
The current password form was still missing, like unto comment #22, until we selected "Account settings" (instead of "Default") as the category on the relationship (kind of like comment #19).
To recap/clarify, with this patch installed, we're able to add all of the form fields on the default User Edit page. On our custom pages, we set the path to user/%user/edit/[tab name] and defined the context of the %user argument as User:ID (and renamed it "User being edited"). Then we added the "User category edit form from user" relationship with the "Account settings" category selected. Then we could accesses all of the form fields, including "User form: add a specific component." On the form field settings, we selected "User category edit form from user" (instead of "User being edited"). The forms are working correctly.
Comment #27
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedThe 3 year old patch in #22 applied cleanly to the latest ctools 7.x-1.x-dev, but may need another review for RTBC status.
Comment #28
rivimeyComment #29
rivimeyComment #30
caschbre CreditAttribution: caschbre as a volunteer commentedWe've been using this patch for several years now on production w/o issue.
Comment #31
tmin CreditAttribution: tmin commented+1
This needs to - finally - get into the stable.
Comment #32
tmin CreditAttribution: tmin commentedPatch at #22 still applies cleanly in: 7.x-1.17 (released 23 October 2020) and works as expected.
Comment #34
joelpittetThanks for your patience everyone, here's #22 committed to the dev release.