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.

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


6 comments

5
May

drupal

Thank you for useful information for users of drupal.
8
Jun

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

18
Jun

 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

30
Aug

Thanks for sharing nice

Thanks for sharing nice information with us. free psp games, get rid of pimples, steam mops, radar detectors. i like your post and all you share with us is up todate and quite informative, i would like to bookmark the page so i can come here again to read you, as you have done a wonderful job.Petite Wigs

5
Oct

Is there any way where i can

Is there any way where i can achieve the above with drupal 6 without having to create a module?

25
Nov

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. bloons tower defense 4

Thanks,