Theme User Login Box
Last modified: September 27, 2009 - 04:02
Hello All,
Below way is to theme user login box.
put below in template.php
<?php
/**
* This snippet will register a theme implementation of the user login form.
*
* Drupal 6.x only!
* Replace 'mytheme' with the name of your theme.
*/
function garland_theme(){
return array(
'user_login_block' => array(
'template' => 'user-login-block',
'arguments' => array('form' => NULL),
)
);
}
?>Make new file "user-login-block.tpl.php" put below in that.
<div id="block-user-0" class="clear-block block block-user" style="background: red; border: 1px solid;">
<div class="content"><form action="/frontpage-videos?destination=frontpage-videos" accept-charset="UTF-8" method="post" id="user-login-form">
<div><div class="form-item" id="edit-name-wrapper">
<label for="edit-name">Username: <span class="form-required" title="This field is required.">*</span></label>
<input type="text" maxlength="60" name="name" id="edit-name" size="15" value="" class="form-text required" />
</div>
<div class="form-item" id="edit-pass-wrapper">
<label for="edit-pass">Password: <span class="form-required" title="This field is required.">*</span></label>
<input type="password" name="pass" id="edit-pass" maxlength="60" size="15" class="form-text required" />
</div>
<input type="submit" name="op" id="edit-submit" value="Log in" class="form-submit" />
<div class="item-list"><ul><li class="first"><a href="/user/register" title="Create a new user account.">Create new account</a></li>
<li class="last"><a href="/user/password" title="Request new password via e-mail.">Request new password</a></li>
</ul></div><input type="hidden" name="form_build_id" id="form-b0a4374029167b8a896bc04ab0da7f49" value="form-b0a4374029167b8a896bc04ab0da7f49" />
<input type="hidden" name="form_id" id="edit-user-login-block" value="user_login_block" />
</div></form>
</div>
</div>now clear your theme registry, it should work now.

Your Own Redirect
Replace the FORM tag above with the following:
<form action="<?php echo $_SERVER['REDIRECT_URL']; ?>?destination=<?php echo urlencode($_SERVER['REDIRECT_URL']); ?>" accept-charset="UTF-8" method="post" id="user-login-form">This will use the current page as the redirect, bringing the user back here when login is completed.
Also, you do not need the id and value for form_build_id. You can leave them blank:
<input type="hidden" name="form_build_id" id="" value="" />-------------------------------------------
Interactive Worlds and Immersive Obsessions
http://www.asifproductions.com
Seems like...
Seems like I get a double when using the themed block. Any guess?
....
....
Depends on what you mean by
Depends on what you mean by double, but I think I know what your problem is. Try removing the tags from your user-login-block.tpl.php. That did it for me.
(Drupal 6.14)
No offence to the creator of
No offence to the creator of the OP but this is really not the right way of going about advanced Drupal theming.
I'm surprised actually that the admins of this section at drupal.org have left it up as it is misleading for those seeking to gain better control of their theme.
The first part using the hook is fine but don't just dump the entire HTML output into the new template file; you need to learn how to use the preprocess function.
The best online guides that I have read on this subject are those written by 11 Heavens.
http://11heavens.com/theming-the-contact-form-in-Drupal-6
http://11heavens.com/theming-the-register-form-in-Drupal-6
Okay, so learning this methodology it's not necessarily an easy option but there is no easy option for advance Drupal theming when it comes to using heavy PHP code. Solutions, like above, will cause more problems than they solve.
Suburban Glory Web Design