Custom Search
Web CMS Drupal ConfigurationWeb Page, CMS Technology and Drupal Related Configuration Article |
|
Custom Search
NavigationRecent blog posts
Recent comments
Popular contentPoll |
Customize drupal user login block![]() Log in to your drupal site as admin and then, go to administer -> block then go to tab add block to create new customize your drupal user login block. On the block body paste this php code to create the new customize your drupal user login block:
<?php global $user; ?> <?php if ($user->uid) : ?> Welcome: <?php print l($user->name,'user/'.$user->uid); ?> | <?php print l("logout","logout"); ?> <?php else : ?> For full access and to post messages and comments please Login/Register: <?php print l("Login/Register","user/login"); ?> <?php endif; ?>
Make sure that you set the input format as php code To enable the customs login block Hit save block after you tick the enable checkbox to apply the changes. »
Custom Search
|
Another version
edit drupal login block and paste this php code
<?php global $user; ?>
<?php if ($user->uid) : ?>
<span class="login_text"><br><br><b>Logged in as: </span> <?php print l($user->name,'user/'.$user->uid); ?> |
<?php print l("logout","logout"); ?>
<?php else : ?>
<form action="/drupal/?q=user&<?php print drupal_get_destination() ?>" method="post" id="user-login">
Username:
<br>
<input type="text" maxlength="60" name="edit[name]" id="edit-name" size="15" value="" class="form-text required" />
<br>
Password:
<br>
<input type="password" maxlength="" name="edit[pass]" id="edit-pass" size="15" class="form-text required" />
<br>
<input type="submit" name="op" value="Login" 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">Lost password</a>
<input type="hidden" name="edit[form_id]" id="edit-user-login" value="user_login" />
</form>
<?php endif; ?>
Version 3
<?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="/drupal/?q=user&<?php print drupal_get_destination() ?>" method="post" id="user-login">
Username:<input type="text" maxlength="60" name="edit[name]" id="edit-name" size="15" value="" class="form-text required" />
<br>
Password: <input type="password" maxlength="" name="edit[pass]" id="edit-pass" size="15" class="form-text required" />
<br>
<input type="submit" name="op" value="Login" class="form-submit" />
<br>
<a href="/drupal/?q=user/password" title="Retrieve lost password">Retrieve lost password</a>
<input type="hidden" name="edit[form_id]" id="edit-user-login" value="user_login" />
</form>
<?php endif; ?>
Login not working
Thanks for this post - its most helpful. I am using drupal 5.1 and I have copied this code into a block and it works for me, but only when I have the default login block visible. If I remove the login block, by setting its region to <none>, then this custom login block doesn't work anymore. Its got me stumped... If anyone has any suggestions, I would really appreciate it. Paul.
Ditto on the Login Block
is there something peculiar about 5.1 that makes the code not resolve. It's too good a solution for it not to work as described. I too can't seem to figure this out. Any help would be appreciated.
thanks
Javier
Version 4 - adding member login
adding Member Log-In to block name
<?php global $user; ?>
<?php if ($user->uid) : ?>
<span class="login_text">Welcome, </span> <b><?php print ($user->name); ?> </b> <br>
<?php print l("Your Account",'user/'.$user->uid); ?> |
<?php print l("Log-Out","logout"); ?>
<?php else : ?>
<form action="/drupal/?q=user&<?php print drupal_get_destination() ?>" method="post" id="user-login">
Username:
<br>
<input type="text" maxlength="60" name="edit[name]" id="edit-name" size="15" value="" class="form-text required" />
<br>
Password:
<br>
<input type="password" maxlength="" name="edit[pass]" id="edit-pass" size="15" class="form-text required" />
<br>
<input type="submit" name="op" value="Login" 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="edit[form_id]" id="edit-user-login" value="user_login" />
</form>
<?php endif; ?>
Don't use this script!
Little bit of advice
1. read till the end of post. notice that there is posibble solution for drupal 5.1
Possible solution for drupal version5.1
2. Then understand the content.
3. Understant the scripts..
4. If you cannot login using newly created login block... you can always go back and login using the default login block http://your_drupal_site_name.com/?q=user
5. and most important... dont be rude...
Custom login script rocks!
I added your node link to the drupal site
http://drupal.org/node/92657
specifically here http://drupal.org/node/92657#comment-195824
Possible solution for drupal version5.1
This is may be another solution / alternative custome login block for drupal version 5
http://www.nossdutytask.com/node/240
drupal
thanks
useful information for users of drupal.
drupal very informative site i found many things
buy a college degree
________________
earn degree online | affordable online education
Detailed Explanation
I read your post and the information is very good. Keep it up. Thanks.
Kohler Dealers
Fantastic post. Bookmarked
Fantastic post. Bookmarked this site and emailed it to a few friends, your post was that great, keep it up.

It's good blog..The drupal
It's good blog..The drupal login code are too good..
---------
discounted clothing
Recent versions of Drupal
Recent versions of Drupal have the oh-so-cool feature that allows you to host many websites off a single Drupal codebase. The coolest part about this is that you can share some tables accross multiple websites; which means you can do things like have a single username/password table accross all the websites.
Thanks,
Website Design
I am using drupal 5.1 and
I am using drupal 5.1 and I have copied this code into a block and it works for me, but only when I have the default login block visible. If I remove the login block, by setting its region to <none>, then this custom login block doesn't work anymore. Its got me stumped... If anyone has any suggestions, I would really appreciate it.
club penguin
I am learing drupal...I
This is a site which
drupal
I am learing drupal...I have to collect more details...Here I found many good information about drupal.Thanks for sharing.
Thanks,
Life Insurance Quote
This is a good blog. I too
These are really a good
Great blog, figuring this
Great blog, figuring this stuff out isn't easy and this has helped greatly.
online education degree
online computers degree
online nursing degree