Skip to content

Instantly share code, notes, and snippets.

@driesd
Created October 8, 2013 09:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save driesd/6882333 to your computer and use it in GitHub Desktop.
Save driesd/6882333 to your computer and use it in GitHub Desktop.
Customize the Drupal user forms (login & register)
<?php
/**
* Implements hook_user_login
*/
function MODULE_form_user_login_alter(&$form, &$form_state) {
$form['already_customer'] = array(
'#type' => 'markup',
'#markup' => '<h3>' . t('I am already a customer') . '</h3>',
'#weight' => -10,
);
$form['forgot_password'] = array(
'#type' => 'markup',
'#markup' => '<div class="forgot-password"><p>' . l(t('Forgot password?'), 'user/password', array('attributes' => array('title' => t('Forgot password?')))) . '</p></div>',
'#weight' => 20,
);
}
/**
* Implements hook_user_register_form
*/
function MODULE_form_user_register_form_alter(&$form, &$form_state) {
$form['new_customer'] = array(
'#type' => 'markup',
'#markup' => '<h3>' . t('New here?') . '</h3>',
'#weight' => 0,
);
}
@fxcjahid
Copy link

fxcjahid commented Apr 22, 2022

Thanks <3
it also worked on THEME FILE your_theme_name.theme

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment