Customize and Modify Drupal login for Drupal 5.x


The latest modification for Drupal 5 login form / block.
My code modification of drupal login block on 18-10-2007. The latest modification of the login block is to make sure that user stay on the current page or post after they logout.
1. Now user can stay on the page as they login to the site.
2. Stay on the same page after they logout from the site (base on the permisssion).
p.s: if something happen and you cannot login using the custome login page, you can always use the default Drupal loging page located at http://yoursite_name.com/?q=user. Make sure that you anable clean URLs for your site that located at = Administer -> Site configuration -> Clean URLs (set to enable)
Add below code on = Administer -> Site building -> Blocks (add new login block)
<?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", array(), drupal_get_destination()); ?>
<?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's blog
- Login or register to post comments
- 3895 reads
- Email this page












