Search code examples
phpdrupal-6user-registration

how can i see the profile field on registration page?


I have made customized user registration page. and i have made that on theme layer.
But now i want to see the the fields which i have made in profile module.
as i have written like this for

<?php print drupal_render($form['account']['name']); ?>

this code will show the user name field. which is default. now i want to see the profile fields which i have created on the profile module.
So can any one tell me what i have to write in drupal_render[?]?
Thanks in advance.


Nitish
Panchjanya Corporation


Solution

  • First, if you are using Drupal 6, you might want to know that you can just choose a checkbox, Appear in Registration page which shows up when you are creating a new user profile field from the Admin UI.

    Else you can try this.

    $categories = profile_categories();
    foreach($categories as $category) {
      $result = _profile_get_fields($category['name']);
      # You can add code here to render each category seperately #
      while($field = db_result($result)) {
        $fieldname = $field['name'];
        drupal_render($form[$category][$fieldname]);
      }
    }