Customize User Login Box ( block )

If you want to customize the User Login box so that everything is displayed on one line like this, then add the following code to the page.tpl.php file of your theme.

<?php global $user; ?>
<?php if ($user->uid) : ?>
<?php print(t('Logged in as:'))?> <?php print l($user->name,'user/'.$user->uid); ?> |
<?php print l((t('log out')),"logout"); ?>
<?php else : ?>

" method="post">
<?php print l((t('Register')),"user/register"); ?> | <?php print(t('Login:'))?>



" />

<?php endif; ?>

More information can be found on

http://drupal.org/node/350634

Comments

hi guys,

I did some experiments with this. You can style drupal login block horizontally to look like facebook very easily.

Please refer to this code snippet for getting code Horizontal Custom Drupal Login Block

See the Action at http://www.ohmybaby.in

Logic:
------
1) Tell your theme to look for new template for login block
2)Create a new login block template file and render the form elements inside that

Step 1 :

Create a file called “user-login-block.tpl.php” in the following directory
“/themes /yourtheme/” .
Step 2:

Put the following code in that file.

<?php
print drupal_render($form['name']);
// prints the username field
?>

<?php
print drupal_render($form['pass']); // print the password field
?>

<?php
print drupal_render($form['submit']); // print the submit button
?>

<?php
print drupal_render($form); //print remaining form elements like "create new account"
?>


You can create your own tags and place the forms elements there, if you are specific about tags.

Step 3:

In your template.php add the following function

function zen_classic_theme(&$existing, $type, $theme, $path)
{
return array(
'user_login_block' => array (
'template' => 'user-login-block',
'arguments' => array('form' => NULL)
)
);

}
This is for Zen classic theme . You can change it Like , “ garland_theme ” .
(i.e) “yourtheme name_theme”.

for garland users

function garland_theme()
{
return array(
'user_login_block' => array (
'template' => 'user-login-block',
'arguments' => array('form' => NULL)
)
);

}