How I can to add a form with more questions with the registration system?

When a user register an account I only have a form with tow fields (the username and the e-mail), I would like to add more questions and fields, like country, interests... in the user registration form.

How I can do it?


oriol_e9g’s picture

NewsTrend’s picture

You may find an issue in that your additional fields show above the standard registrations fields. I am trying to add fields, like you are, and found they appeared above, rather than below.

I belive there is a patch for this:


--- profile.module.dist	2007-02-01 06:18:47.000000000 -0800
+++ profile.module	2007-02-01 06:20:27.000000000 -0800
@@ -619,7 +619,7 @@ function profile_form_profile($edit, $us
     // Use LOWER('%s') instead of PHP's strtolower() to avoid UTF-8 conversion issues.
-  $w = 0;
+  $w = 1;
   while ($field = db_fetch_object($result)) {
     $category = $field->category;
     if (!isset($fields[$category])) {

The probelm I'm having is I'm not sure how to apply a patch (newbie, non-programmer). Help?

VM’s picture

the above patch is actually easy and can be done by hand.
open profile.module

FIND $w = 0;
and change that 0 to a 1

basically - means remove and + means add
you do nothing with the while statement, it acts like a road marker.

more information on how to patch can be found in the handbook, use search how to patch its the first thread.

sizemeup’s picture

Hi I am a newbie to drupal.

I started by working my way through the following video which ref this post in the second exercise.

I am so new to drupal I don't know which version I am using.

However in the profile.module file I can't find $w = 0;

I can find the following code which looks similar to the code in the first post here but changing $weight is having no effect.

function profile_form_profile($edit, $user, $category, $register = FALSE) {
$result = _profile_get_fields($category, $register);
$weight = 1;
$fields = array();
while ($field = db_fetch_object($result)) {
$category = $field->category;
if (!isset($fields[$category])) {
$fields[$category] = array('#type' => 'fieldset', '#title' => check_plain($category), '#weight' => $weight++);

Can anyone help bring me up today ? Many thanks in advance

VM’s picture

new or not you should know what version of drupal is in use. go to administer -> status logs check drupal version.

What you are trying to do no longer has to be done because it's been fixed in later versions of drupal.
$w = 0 was changed to $weight = 1

therefore you aren't doing yourself any favors with regards to watching that tutorial nor trying to follow it especially if you don't know what version of drupal you are using as this was a bug in Drupal 5.

avinash_thombre’s picture

In order to add fields to "Create Account" registration form, you can do this in following way:

Go to "--/admin/config/people/accounts/fields" then while "Add new field". While adding new field, under label you could see "Display on user registration form". Check this box and the corresponding field will be shown on registration form. 

VM’s picture

I don't believe the advice wouldn't work as the feature and paths in Drupal 5 were quite different. Please don't resurrect old posts for EOL versions of Drupal core.