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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Letharion’s picture

Project: Panels » Chaos Tool Suite (ctools)
Version: 7.x-3.0-alpha3 » 7.x-1.x-dev
Component: Panel pages » Miscellaneous
Status: Active » Postponed (maintainer needs more info)

I'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.

tthenne’s picture

Status: Postponed (maintainer needs more info) » Active

@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

tthenne’s picture

Shouldn'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?

Ashlar’s picture

Status: Active » Closed (won't fix)

This 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.

floretan’s picture

Status: Closed (won't fix) » Needs review
FileSize
2.72 KB

Overriding 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.

floretan’s picture

Category: support » feature
broeker’s picture

Patch 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).

broeker’s picture

Issue summary: View changes

Edit to initial post.

SilviaT’s picture

Same 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.

paulbuk’s picture

Issue summary: View changes

Hey, 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 (-:

maximpodorov’s picture

This is unusable until the user edit form context is available which can take placeholders.

tnathanjames’s picture

Here 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.

maximpodorov’s picture

The patch file is incomplete.

joelpittet’s picture

Status: Needs review » Needs work

As per #13

tnathanjames’s picture

Sorry everyone. Leaving --name-only on the diff is no good :).

Here is the actual file.

tnathanjames’s picture

Status: Needs work » Needs review
joelpittet’s picture

Thanks @tnathanjames, glad you had it still on hand.

tnathanjames’s picture

Updated an invalid comment after a peer review.

tmin’s picture

I 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.

tmin’s picture

Status: Needs review » Reviewed & tested by the community

Assuming that the above-mentioned .png file that is missing is replaced somehow, the core functionality of the patch seems absolutely fine.

Argus’s picture

Confirming the patch in #18 is working fine. Tested all default fields, added some custom fields.

tnathanjames’s picture

I 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.

tnathanjames’s picture

Status: Reviewed & tested by the community » Needs review
goldin’s picture

Fabulous. 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?

BYUStudies’s picture

This 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?

BYUStudies’s picture

Found 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.

Chris Matthews’s picture

The 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.

rivimey’s picture

Issue summary: View changes
rivimey’s picture

caschbre’s picture

The 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.

We've been using this patch for several years now on production w/o issue.

tmin’s picture

Status: Needs review » Reviewed & tested by the community

We've been using this patch for several years now on production w/o issue.

+1

This needs to - finally - get into the stable.

tmin’s picture

Patch at #22 still applies cleanly in: 7.x-1.17 (released 23 October 2020) and works as expected.

joelpittet’s picture

Status: Reviewed & tested by the community » Fixed
Parent issue: » #3178697: Plan for CTools 7.x-1.18 release

Thanks for your patience everyone, here's #22 committed to the dev release.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.