I want to change the spelling of login button that is there in the login box.is it possible?please help.

Comments

vijaythummar’s picture

yes , you can change it.

Just go to user.module and then there is one function.

function user_login_block() {
$form = array(
'#action' => url($_GET['q'], drupal_get_destination()),
'#id' => 'user-login-form',
'#base' => 'user_login',
);
$form['name'] = array('#type' => 'textfield',
'#title' => t('Username'),
'#maxlength' => USERNAME_MAX_LENGTH,
'#size' => 15,
'#required' => TRUE,
);
$form['pass'] = array('#type' => 'password',
'#title' => t('Password'),
'#maxlength' => 60,
'#size' => 15,
'#required' => TRUE,
);
$form['submit'] = array('#type' => 'submit',
'#value' => t('Log in'),
);
$items = array();
if (variable_get('user_register', 1)) {
$items[] = l(t('Create new account'), 'user/register', array('title' => t('Create a new user account.')));
}
$items[] = l(t('Request new password'), 'user/password', array('title' => t('Request new password via e-mail.')));
$form['links'] = array('#value' => theme('item_list', $items));
return $form;
}

here change the value of submit button.
$form['submit'] = array('#type' => 'submit',
'#value' => t('Log in'),
);

Thanks,
Vijay Thummar

henry4’s picture

Thanks a lot

Ryan Palmer’s picture

Noooo don't change Drupal core!!! Bad advice!!

This text uses the translate function (http://api.drupal.org/api/function/t/5), which enables support for languages other than English. Alternatively, you can change strings of text, within English, to whatever you want.

Either turn on Locale module (built into Drupal) or try the string overrides module: http://drupal.org/project/stringoverrides

aiwata55’s picture

I totally agree. Never, never, ever hack the Drupal core and contributed modules. By hacking them, you lose
1. ability to update your site easily when security patches are released.
You always apply your own modifications every time you update your system.
2. the benefit of open source project.
Once you alter either the core or contributed modules, it is your system and no one knows what it exactly is. Therefore, no one may be able to help you in this forum or IRC channels when you have problems.

Again. Never hack the core and contributed modules.

arif_mandra’s picture

There is also another way to do it with form_alter hook.

function modulename_form_alter ($form, &$form_state, $form_id) {

if ($form_id == 'user_login' || $form_id == 'user_login_block' ) {
$form['submit']['#value'] = 'Submit'; //change here whatever you want, I have updated it as Submit
}

}