[support] changing default Register page

Jason Flatt drupal at oadaeh.net
Fri Feb 16 22:54:13 UTC 2007


On Friday February 16 2007 12:40 pm, will hall wrote:
> hacking user.module sounds more doable. the implication is that if there
> is an upgrade we'd have to re-hack, right?

Yes, and that it's not the Drupal Way(tm).

It's really not that difficult. Put the following D5 code in a file named 
zzz_mods.module in a relevant location in your sites directory, create a 
corresponding .info file, enable it and tweak away. (I changed the titles to 
both fields.) If these are not the fields you wanted to change, find the 
relevant form definitions in the core files, copy, paste and tweak. (If they 
are from a different form, you will need to update the case statement.) No 
core hacking necessary, and probably very little, if anything, in the way of 
tweaking for upgrades.

<?php
function zzz_mods_form_alter($form_id, &$form) {
  switch ($form_id) {
    case 'user_register':
      $form['name'] = array('#type' => 'textfield',
        '#title' => t('This is where you type in your user name'),
        '#size' => 30,
        '#maxlength' => 60,
        '#description' => t('Your full name or your preferred username; only 
letters, numbers and spaces are allowed.'),
        '#required' => TRUE,
      );
      $form['mail'] = array('#type' => 'textfield',
        '#title' => t('This is where you type in your e-mail address'),
        '#size' => 30,
        '#maxlength' => 64,
        '#description' => t('A password and instructions will be sent to this 
e-mail address, so make sure it is accurate.'),
        '#required' => TRUE,
      );
      break;
  }
}

-- 
Jason Flatt
http://www.oadaeh.net/
Father of Six:  http://www.flattfamily.com/ (Joseph, 13; Cramer, 11; Travis, 
9; Angela; Harry, 5; and William, 12:04 am, 12-29-2005)
Linux User:     http://www.kubuntu.org/
Drupal Fanatic: http://drupal.org/


More information about the support mailing list