As Drupal 7 doesn't show the language selector for the users who create their own account, you need to implement hook_form_user_register_form_alter()
(see the documentation for hook_form_FORM_ID_alter()) using the following code.
function mymodule_form_user_register_form_alter(&$form, &$form_state) {
// Only alter user forms if there is more than one language.
if (!isset($form['locale']) && drupal_multilingual()) {
locale_language_selector_form($form, $form_state, $form['#user']);
}
if (isset($form['locale']) {
$form['locale']['#access'] = TRUE;
}
}
The code is generic, and works even in the case a module removed the language selector field (which is something a module should never do, though).
"user_register_form" is the form builder used for the "user/register" path. The code works if the Locale module is enabled. The code will show the language selector if there are more than one language enabled; differently, drupal_multilingual()
would return FALSE
.
$items['user/register'] = array(
'title' => 'Create new account',
'page callback' => 'drupal_get_form',
'page arguments' => array('user_register_form'),
'access callback' => 'user_register_access',
'type' => MENU_LOCAL_TASK,
);
The code used from the Locale module is the following one.
function locale_form_alter(&$form, &$form_state, $form_id) {
// Only alter user forms if there is more than one language.
if (drupal_multilingual()) {
// Display language selector when either creating a user on the admin
// interface or editing a user account.
if ($form_id == 'user_register_form' || ($form_id == 'user_profile_form' && $form['#user_category'] == 'account')) {
locale_language_selector_form($form, $form_state, $form['#user']);
}
}
}
In general, the equivalent for hook_user('register')
in Drupal 7 is hook_form_user_register_form_alter()
; the equivalent of hook_user('form')
is hook_form_user_profile_form_alter()
.