Where can I set a default value for the e-mail field on user create page. What I'm after: when new account is created, the field e-mail has already a set value in it i.e. @mail.com
go to modules/user open user.module and go to line 1474 (or somewhere around), and look for the below piece of code
<code>
go to modules/user open user.module and go to line 1474 (or somewhere around), and look for the below piece of code
$form['account']['mail'] = array('#type' => 'textfield', '#title' => t('E-mail address'), '#default_value' => $edit['mail'], '#maxlength' => EMAIL_MAX_LENGTH, '#description' => t('A valid e-mail address. All e-mails from the system will be sent to this address. The e-mail address is not made public and will only be used if you wish to receive a new password or wish to receive certain news or notifications by e-mail.'), '#required' => TRUE, );</code> as you can see you can set a default value over there, or even remove the required attribute
Yeah, I guess your right, especially if the page is on the internet, any changes to the core can affect security. But if the page is running on a closed intranet, cut off from outside, this is a bit simpler and quicker (if you know where to look, that is)
got it
if someone will need this to, here's how:
go to modules/user
open user.module and go to line 1474 (or somewhere around), and look for the below piece of code
<code>
go to modules/user
open user.module and go to line 1474 (or somewhere around), and look for the below piece of code
$form['account']['mail'] = array('#type' => 'textfield',</code> as you can see you can set a default value over there, or even remove the required attribute'#title' => t('E-mail address'),
'#default_value' => $edit['mail'],
'#maxlength' => EMAIL_MAX_LENGTH,
'#description' => t('A valid e-mail address. All e-mails from the system will be sent to this address. The e-mail address is not made public and will only be used if you wish to receive a new password or wish to receive certain news or notifications by e-mail.'),
'#required' => TRUE,
);
NEVER Hack Drupal Core
Partialy right, but you should NEVER change any of the Drupal core files.
Instead create your own custom module and use hook_form_alter() to make changes to the form.
Yeah, I guess your right,
Yeah, I guess your right, especially if the page is on the internet, any changes to the core can affect security. But if the page is running on a closed intranet, cut off from outside, this is a bit simpler and quicker (if you know where to look, that is)
Maintenance
There's also the issue of trying to maintain a hacked system.
It's not at all necessary to make the hack in the first place either, just use hook_form_alter().
Piece of cake!