Theming the login form in Drupal 6
peach - June 4, 2008 - 12:57
Hi!
In Drumepal 6, theming stuff was supposed to be easier, but I'm not really feeling it. Doing my first D6 theme now and Im stuck on the login form.
I found this great article on lullabot: http://www.lullabot.com/articles/modifying-forms-5-and-6
And I've tried to modify their template.php functions for use with my theme, but the following code does not touch the login form:
<?php
function mytheme_theme() {
return array(
// The form ID.
'user_login_form' => array(
// Forms always take the form argument.
'arguments' => array('form' => NULL),
),
);
}
?><?php
function mytheme_user_login_form($form) {
$output = '';
// Print out the $form array to see all the elements we are working with.
$output .= 'BLABLABLBLAAAA';
$output .= print_r($form);
// Once I know which part of the array I'm after we can change it.
// You can use the normal Form API structure to change things, like so:
// Change the Username field title to Login ID.
// Make sure you call a drupal_render() on the entire $form to make sure you
// still output all of the elements (particularly hidden ones needed
// for the form to function properly.)
$output .= drupal_render($form);
return $output;
}
?>And as far as I can see, user-login is also not one of the new default templates in D6, any help would be greatly appreciated!

that article might be a bit
that article might be a bit out of date (maybe)
try here
http://www.drupaldojo.com/lesson/fine-tuning-the-ui-by-theming-forms-in-...
I've tried theming the login form but haven't had any success - from what i remember I think i was calling an incorrect id for the form, I'd be interested if you have a solution Ive posted on this on the forums here
http://drupal.org/node/240124
Hi, I dont think the
Hi, I dont think the lullabot article is out of date, I tried their example with the user edit form and it worked just fine.
I'll download the screencast for later, thanks ;)
-------------------------------
peach from All Drupal Themes
I should have extend theres
I should have extend theres a lot more preprocessing capabilities in D6 a lot more control
A huge headache, but
I've found the source of the problem. After looking at the source of the user.module, I've found that the id of the user login form is not it's html id (user_login_form), but user_login_block.
So it works this way:
<?phpfunction mytheme_theme() {
return array(
// The form ID.
'user_login_block' => array(
// Forms always take the form argument.
'arguments' => array('form' => NULL),
),
);
}
?>
<?php
function mytheme_user_login_block($form) {
$output = '';
// Print out the $form array to see all the elements we are working with.
$output .= 'BLABLABLBLAAAA';
$output .= print_r($form);
// Once I know which part of the array I'm after we can change it.
// You can use the normal Form API structure to change things, like so:
// Change the Username field title to Login ID.
// Make sure you call a drupal_render() on the entire $form to make sure you
// still output all of the elements (particularly hidden ones needed
// for the form to function properly.)
$output .= drupal_render($form);
return $output;
}
?>
Lesson learned: always search for drupal_get_form in the source of the module because naming of the form ids are not always consistent.
Good find Istvan That fixes
Good find Istvan
That fixes that problem thanks for the tip