user_login_block

Public

Enables the user registration and login system.

Get raw version
php
  1. function user_login_block($form) {
  2. $form ['#action'] = url(current_path(), array('query' => drupal_get_destination(), 'external' => FALSE));
  3. $form ['#id'] = 'user-login-form';
  4. $form ['#validate'] = user_login_default_validators();
  5. $form ['#submit'][] = 'user_login_submit';
  6. $form ['name'] = array('#type' => 'textfield',
  7. '#title' => t('Username'),
  8. '#maxlength' => USERNAME_MAX_LENGTH,
  9. '#size' => 15,
  10. '#required' => TRUE,
  11. );
  12. $form ['pass'] = array('#type' => 'password',
  13. '#title' => t('Password'),
  14. '#size' => 15,
  15. '#required' => TRUE,
  16. );
  17. $form ['actions'] = array('#type' => 'actions');
  18. $form ['actions']['submit'] = array('#type' => 'submit',
  19. '#value' => t('Log in'),
  20. );
  21. $items = array();
  22. if (variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)) {
  23. $items [] = l(t('Create new account'), 'user/register', array('attributes' => array('title' => t('Create a new user account.'))));
  24. }
  25. $items [] = l(t('Request new password'), 'user/password', array('attributes' => array('title' => t('Request new password via e-mail.'))));
  26. $form ['links'] = array('#markup' => theme('item_list', array('items' => $items)));
  27. return $form;
  28. }