Customize User Login Block for Drupal 5.1The code below is to make customize user login block for drupal 5.1. This is the sample code, you can customize this code to better suit your site configuration :-).
<?php global $user; ?>
<?php if ($user->uid) : ?>
<span class="login_text">Welcome, </span> <?php print ($user->name); ?> <br>
<?php print l("Your Account",'user/'.$user->uid); ?> |
<?php print l("Log-Out","logout"); ?>
<?php else : ?>
<form action="/user" method="post" id="user-login-form">
Username:
<input type="text" maxlength="60" name="name" id="edit-name" size="15" value="" tabindex="1" class="form-text required" />
<br>
Password:
<input type="password" name="pass" id="edit-pass" size="15" tabindex="2" class="form-text required" />
<br>
<input type="submit" name="op" id="edit-submit" value="Log in" tabindex="3" class="form-submit" />
<br>
<a href="/drupal/?q=user/register" title="Create account">Create account</a>
<br>
<a href="/drupal/?q=user/password" title="Retrieve lost password">Retrieve lost password</a>
<input type="hidden" name="form_id" id="edit-user-login" value="user_login" />
</form>
<?php endif; ?>
This article derrived from the "
Customize drupal user login block" for Drupal version 4.7.
Bookmark/Search this post with
26 comments
login and stick on current page.
Submitted by drupal on Wed, 2007/03/14 - 16:26.testing code:
this code may be usefull if you want your user log in and stay on current page. change this code:
<form action="/user" method="post" id="user-login-form">
to:
 <form action="/user?<?php print drupal_get_destination() ?>" method="post" id="user-login-form">
Complete Code after modification:
 <?php global $user; ?>
<?php if ($user->uid) : ?>
<span class="login_text">Welcome, </span> <?php print ($user->name); ?> <br>
<?php print l("Your Account",'user/'.$user->uid); ?> |
<?php print l("Log-Out","logout"); ?>
<?php else : ?>
<form action="/user?<?php print drupal_get_destination() ?>" method="post" id="user-login-form">
Username:
<input type="text" maxlength="60" name="name" id="edit-name" size="15" value="" tabindex="1" class="form-text required" />
<br>
Password:
<input type="password" name="pass" id="edit-pass" size="15" tabindex="2" class="form-text required" />
<br>
<input type="submit" name="op" id="edit-submit" value="Log in" tabindex="3" class="form-submit" />
<br>
<a href="/drupal/?q=user/register" title="Create account">Create account</a>
<br>
<a href="/drupal/?q=user/password" title="Retrieve lost password">Retrieve lost password</a>
<input type="hidden" name="form_id" id="edit-user-login" value="user_login" />
</form>
<?php endif; ?>
Drupal 5 custom login block example
Submitted by drupal on Sun, 2007/08/19 - 23:35.the example of working drupal login block on drupal 5.x...
Working example for Login Block Drupal 5.x
Submitted by drupal on Thu, 2007/10/04 - 12:59.want to see the working example of the log in block...
figure 1. before you key in login name and password...
Â
figure 2. after you log in on the drupal system.Â
Â
 see on top of this site you will see the current example.
Personal touch
Submitted by Anonymous on Wed, 2007/10/24 - 03:09.I just add my personal touch as I had to figure out how to customize it with my CSS template. Plus, I added the $base_url variable not to be depending on the root location of the website.
Hope it helps.
Here is the code:
<?php global $user, $base_url; ?>
<?php if ($user->uid) : ?>
<span class="login_text">Welcome </span> <?php print ($user->name); ?> <br>
<?php print l("My account",'user/'.$user->uid); ?> |
<?php print l("Log out","logout"); ?>
<?php else : ?>
<form action="<?php echo $base_url; ?>/user?<?php print drupal_get_destination() ?>" method="post" id="user-login-form">
<div class="login_form_label">Username:</div>
<input type="text" name="name" id="edit-name" size="15" maxlength="12" value="" tabindex="1" class="login_input" />
<div class="login_form_label">Password:</div>
<input type="password" name="pass" id="edit-pass" size="15" maxlength="12" tabindex="2" class="login_input" />
<input type="image" name="op" id="edit-submit" value="Log in" tabindex="3" src="<?php echo $base_url; ?>/themes/wcc/img/login/login_button.gif" alt="Submit" />
<br />
<a href="<?php echo $base_url; ?>/?q=user/password" title="Retrieve lost password" class="login_form_link" >Lost password?</a>
<input type="hidden" name="form_id" id="edit-user-login" value="user_login" />
</form>
<?php endif; ?>
Thanks to the guys from nossdutytask.com
Vince, contact@webcoastcustom.com
Return to the current page after user login
Submitted by Anonymous on Wed, 2008/06/04 - 21:21.if you expand the form action to include a return address, you may be returned to the current page after a successful login.
Exchange this:
<form action="/user" method="post" id="user-login-form">
with this:
<form action="<?php print url('user', drupal_get_destination()); ?>" method="post" id="user-login-form">
horizontal custom drupal login block with active link highlight
Submitted by daydreamer on Mon, 2009/03/30 - 08:09.Hi guys, you might want to make the Drupal Login Box aligned horizontally.
Like facebook at this url here: Horizontal Custom Drupal Login Block
thanks
Submitted by mivpl (not verified) on Mon, 2011/12/19 - 16:39.thanks for the fix club peinguin.Ways to Make Money Online Claim PPI
Hi, I just add my personal
Submitted by Ad3m on Sat, 2009/04/04 - 20:18.I just add my personal touch as I had to figure out how to customize it with my CSS template. Plus, I added the $base_url variable not to be depending on the root location of the website. <a href="http://www.muhabbetim.in" title="Muhabbet, chat">Muhabbet</a> , <a href="http://www.sohbet32.net" title="Sohbet, chat">Sohbet</a>
Hope it helps.
Works
Submitted by jasonsecada on Sun, 2009/05/10 - 21:21.This works fine.
_______________________Neck Pain | Singapore Hotel
This was a solid post. Thank
Submitted by John47123 (not verified) on Mon, 2011/07/18 - 03:56.This was a solid post. Thank you for sharing it. ITIL Certification
RE:
Submitted by PeterWarner on Thu, 2009/05/14 - 14:13.Exchange this: <form
Submitted by hankjmatt on Thu, 2009/06/18 - 13:17.Exchange this:
<form action="/user" method="post" id="user-login-form">
with this:
<form action="<?php print url('user', drupal_get_destination()); ?>" method="post" id="user-login-form">
club penguin
This code looks great,
Submitted by AlbertF on Wed, 2009/06/24 - 02:19.This code looks great, thanks for the fix club peinguin.Ways to Make Money OnlineÂ
Is there a way I can transfer
Submitted by DavidGosts Seven (not verified) on Mon, 2012/04/02 - 15:14.Is there a way I can transfer all my wordpress posts into it? Any help would be greatly appreciated!
Why Not Try THESE Out
hmm
Submitted by cisse on Thu, 2009/07/16 - 12:54.This is the sample code, you can customize this code to better suit your site configuration :-).
____________________
get degree | graduate diploma
very good comment thanks
Submitted by Qulit (not verified) on Wed, 2011/08/17 - 07:38.very good comment thanks youu
Hi,
I just add my personal touch as I had to figure out how to customize it with my CSS template. Plus, I added the $base_url variable not to be chat depending Mynet on the root location of video sitesi the website.
Hope it helps.
Here is the code:
<?php global $user, $base_url; ?>
<?php if ($user->uid) : ?>
Welcome <?php print ($user->name); ?>
<?php print l("My account",'user/'.$user->uid); ?> |
<?php print l("Log out","logout"); ?>
<?php else : ?>
/user?<?php print drupal_get_destination() ?>" method="post" id="user-login-form">
Username:
Password:
/themes/wcc/img/login/login_button.gif" alt="Submit" />
/?q=user/password" title="Retrieve lost password" class="login_form_link" >Lost password?
<?php endif; ?>
Thanks to the guys from nossdutytask.com
You've some helpful ideas!
Submitted by claire redfield (not verified) on Thu, 2011/08/18 - 17:12.You've some helpful ideas! Maybe I ought to consider doing this by my self. i've been looking for this TUT! so far the feedbacks are good, hopefully it will work on me..
I am keen to get best updates
Submitted by calorie banana (not verified) on Sun, 2011/09/25 - 21:15.I am keen to get best updates about important things.Please do send me email about these updates.
calorie banana
Every day I do try to look
Submitted by mariabarka (not verified) on Mon, 2011/10/31 - 17:52.Every day I do try to look for the knowledge like that, I saw many sites but yours is very interesting, you got talent in writing articles, blog bookmarked! Waiting for more info! Clubmz Reviews
Drupal RewriteRule for Enable or disable clean URLs for Drupal s
Submitted by Luqmankhan (not verified) on Fri, 2011/11/25 - 19:01.#
# Apache/PHP/Drupal settings:
#
# Protect files and directories from prying eyes.
Order allow,deny
# Don't show directory listings for URLs which map to a directory.
Drupal
Submitted by Dadodir (not verified) on Fri, 2012/02/03 - 18:36.Hallo, I'm totally new in Drupal, i use Joomla. Can you someone share with me difference between those too in performance? Thank you!
Performance
Submitted by Mark (not verified) on Tue, 2012/03/27 - 23:32.I havent really seen any difference but I think there are some. But well I would recommend you to stay at Joomla since you learned it on how to operate it.
Jailbreak iPhone 4 Verizon
Nice
Submitted by Mothers Day Pictures (not verified) on Wed, 2012/04/11 - 03:01.I ought to think doing this by my self. I’ve been looking for this TUT! So far the feedbacks are good, confidently it will work on me...
This is very helpful to
Submitted by gimmy (not verified) on Thu, 2012/04/19 - 03:24.This is very helpful to understand the proper working for the Drupal and i will be trying the same on some of my own projects.
Regards,
Cytracom
http://www.cytracom.com/
Most of the experts who have
Submitted by E20-390 (not verified) on Tue, 2012/05/01 - 17:25.Most of the experts who have formerly joined this evaluation have given their reviews as this evaluation is specialized and challenging in characteristics.
My site is also a system of
Submitted by Rose Willington (not verified) on Tue, 2012/05/15 - 02:28.My site is also a system of Drupal version 4.7. Thanks to this code is useful to me. buy duty free alcohol online