Customize drupal user login block

cms technology web page configuration drupal web site

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.

drupal login regester customisedrupal welcome

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

drupal input format

 PHP code You may post PHP code. You should include <?php ?> tags

Then click the save button.

 drupal save block button

 To enable the customs login block

drupal block

Hit save block after you tick the enable checkbox to apply the changes.

drupal save block


Another version

log in register drupalwelcome

 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&amp;<?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

loginwelcome

 

<?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&amp;<?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

login register drupalwelcome user

 

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&amp;<?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!

I used this script and it locked me out of my own install - it lets me log in, but I only have user rights.  Fortunately, it was a new installation of Drupal 5.1 that I will wipe out from the server side.  But I will be using posted scripts much more cautiously in the future.

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!

Awesome. Just what I was looking for!

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

Thank you for useful information for users of 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.online roulette poker calculator online blackjack video poker divx movies horse betting iphone games play slot machine online

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

I am learing drupal...I trust to ensue supplementary details...Here I make prevalent pertinent poop about drupal.Thanks for sharing. Atlanta Internet Marketing

This is a site which

This is a site which provides all the information about the forniture tatuaggi.Dat's why I really like drupal which provides much info. I was learning it at present. Thanks for sharing.

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

This is a good blog. I too can't seem to figure this out. Any help would be appreciated. Thanks, free games

These are really a good

These are really a good session writings.This is a very nice blog and informative as well. concert tickets

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

 

Custom Search