Download & Extend

Prepopulating "Add a new user" admin form

Project:Prepopulate
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

Hello there,

I found out how to prefill the "User register" form at "user/register", but I cannot prefill the form in the admin interface. I would like to add "users" to my drupal site by prefilling certain values from a cck "contact" node.

Basically I would import the name and the email from the contact node to the "Add user" adin form.. Is there any way you see to do this?

thanks alot!

Patchak

Comments

#1

please, please!! Anyone has an idea how to do this??

Patchak

#2

I found out how to prefill the "User register" form at "user/register", but I cannot prefill the form in the admin interface. I would like to add "users" to my drupal site by prefilling certain values from a cck "contact" node.

How did you prepopulate the registration form fields? I suspect the problems I'm encountering are related to fields within unnamed fieldsets. How would I prepopulate a user's email address and registration code?

Thanks

#3

I am also having problems prepopulating my user registration fields.

I have used prepopulate elsewhere in my site but I cannot get it to work on the user/register site.

I have CCK and Content Profile installed and I have designated a few fields to be filled in on registration. Is this the case with you mgl4421 and patchak? Perhaps this could be the problem?...

Please let me know! Many thanks,

Ben

#4

I managed to prepopulate user registration fields using another module, have a look at my reply to a similar issue.

#5

Hi,

I'm having the same issue. Any direction from the maintainers would be appreciated!

Albert.

#6

Hi,
I needed to pre-populate the user registration form too, but found the following worked for me (after a few hours of messing) with the latest 6.x-2.x-dev version.

If you have Profile fields in the registration form, it'll put these fields into fieldset tags with legend tags to display the name of the fieldset. You'll need to pass the legend text as part of the Prepopulate argument.

Here's an example structure with the fieldset groupings, plus the ID and NAME attributes of the input tags:

Account Information
Username (id="edit-name" name="name")
E-mail address (id="edit-mail" name="mail")
Personal Information
Name (id="edit-profile-name" name="profile_name")
Job Title (id="edit-profile-title" name="profile_title")
Company (id="edit-profile-company" name="profile_company")

To pre-populate Job Title on the registration form via the URL I used the following syntax:

http://mysite.com/user/register?edit[Personal%20Information][profile_title]=Nerd

or, via a hidden form element and POST:
<input type="hidden" name="edit[Personal%20Information][profile_title]" id="edit[Personal%20Information][profile-title]" value="Nerd" />

Note that the legend text "Personal Information" is case sensitive and that I've URL encoded the space character. Also be careful with the ID and NAME attributes, it's the NAME attribute you want to use, an it has an underscore "_" rather than a hyphen "-".

Confusingly, the Account Information elements (Username and E-mail Address) are handled slightly differently. To pre-populate the E-mail Address use the following syntax:

http://mysite.com/user/register?edit[account][mail]=me%40mysite.com

or, via a hidden form element and POST:
<input type="hidden" name="edit[account][mail]" id="edit[account][mail]" value="me%40mysite.com" />

Note that even if the legend reads "Account Information", you need to pass the value [account] instead - and it's case sensitive.

And finally, if you don't have any Profile fields visible on the user registration form, then Username and E-mail Address are not grouped in a fieldset so you need to use:

http://mysite.com/user/register?edit[mail]=me%40mysite.com

or, via a hidden form element and POST:
<input type="hidden" name="edit[mail]" id="edit[mail]" value="me%40mysite.com" />

Note the lack of "[account]" in the arguments.

#7

@muckermarc thanks, your input appreciated.

nobody click here