Posted by gdevlugt on February 12, 2008 at 10:46am
Jump to:
| Project: | Documentation |
| Component: | Correction/Clarification |
| Category: | support request |
| Priority: | normal |
| Assigned: | davideads |
| Status: | closed (fixed) |
Issue Summary
Since in Drupal 6, the _phptemplate_callback() function is no longer supported, the code snippets on the 'Customising the login form' page at http://drupal.org/node/19855 doesn't work for Drupal 6.
I did some investigating in the new theming changes and came up with a snippet which does work for Drupal 6.
For Step 1 of 2, mentioned on the page, the code which should be added to template.php for Drupal 6.x is :
<?php
/**
* This snippet will register a theme implementation of the user login form.
*
* Drupal 6.x only!
* Replace 'mytheme' with the name of your theme.
*/
function mytheme_theme() {
return array(
'user_login' => array(
'template' => 'user-login',
'arguments' => array('form' => NULL),
),
);
}
/**
* Theme implementation of the user login form.
*
* Drupal 6.x only!
* Replace 'mytheme' with the name of your theme.
*/
function mytheme_user_login($form) {
return drupal_render($form);
}
?>For Step 2 of 2 mentioned on the page, the procedure for Drupal 6.x is exactly the same as for Drupal 5.x.
Hope this helps a bit.
Comments
#1
I did some further testing and the code (second function) :
<?php/**
* Theme implementation of the user login form.
*
* Drupal 6.x only!
* Replace 'mytheme' with the name of your theme.
*/
function mytheme_user_login($form) {
return drupal_render($form);
}
?>
isn't needed. It was a leftover from some testing. Sorry for the confusion.
#2
I can't get this to work, the extra text does not appear. Any idea where I might be going wrong?
Should
user-loginbeuser_loginbtw? I've tried it both ways, still doesn't work.#3
... does this only work for the dedicated login page per chance?
#4
Hi,
You could try to add the following code to the top of your page.tpl.php file :
<?php drupal_rebuild_theme_registry(); ?>This will clear out any theme cache left overs preventing things to show up.
The code applies to the dedicated login page.
#5
Working on this at DrupalCon.
nikkiana
knitgeeklife.com
#6
<?phpfunction mytheme_theme() {
return array(
'user_login_block' => array(
'template' => 'user_login',
'arguments' => array('form' => NULL),
),
);
}
?>
will let you change the small login box. And yes, if you use Drupal 5's step 2, you will need to change template's value from 'user-login' to 'user_login'.
Thanks for this, I was struggling with it until now.
#7
Wondering how to modify my Drupal 6.2 Login Form...
I would like to add custom CSS classes to the input fields, add small images above the username and password input fields, and remove the "Username: *" and "Password: *" text.
Any help is greatly appreciated!
Thanks! :)
#8
Hi!
Ther is a great way to modify internal forms. This puts out a small login form in my header:
<?php
function loginform() {
$loginform=user_login_block();
$loginform['name']['#size']=15;
$loginform['name']['#title']="Name";
$loginform['name']['#description']="";
$loginform['pass']['#size']=8;
$loginform['pass']['#title']="Passwort";
$loginform['pass']['#description']="";
//print_r($loginform);
return $loginform;
}
print drupal_get_form('loginform');
?>
I am getting the whole document from drupal and modifying some ugly values.
To see the array and all values, uncomment the
print_rThis login Form is always displayed. make your own "User bar" as described here: http://drupal.org/node/92657
Is there an so-called CSS-Guru out there, who can help me out with theming of this?
<label for="edit-name">Name: <span class="form-required" title="This field is required.">*</span></label><input type="text" maxlength="60" name="name" id="edit-name" size="15" value="" class="form-text required" />
i just don't know how to change the labe-font. tried #edit-name in style.css but doesnt work.
#9
changing component
#10
I updated this to reflect Drupal 6 theming techniques and tested them with my custom theme.
However, I think that the structure and form could use work, so I'd love some review here.
There are also seem to be several variations on this theme in the handbook, and probably they should be combined and cleaned up to form a canonical version of this snippet.
#11
I talked with Addy who said just to mark this fixed and move on :)
#12
The file should be "user-login.tpl.php" and not "user_login.tpl.php" (underscore - no no...).
#13
Automatically closed -- issue fixed for two weeks with no activity.
#14
subscribing
#15
HI there
Where do I find this file ? is it in the user module ?
I want to adjust the length to match the theme, http://www.malebodydecor.com
How do I do this please ?
Thanks