In line login

Hi all

I'm trying without success to create the login box to be inline under the secondary menu block.

Trawled the web and found the following suggestion:-
STAGE ONE
1) Tell your theme to look for new template for login block
2)Create a new login block template file and render the form elements inside that
Step 1 :
Create a file called “user-login-block.tpl.php” in the following directory
“/themes /yourtheme/” .
Step 2:
Put the following code in that file.

<?php
print drupal_render($form['name']);
// prints the username field
?>
<?php
print drupal_render($form['pass']); // print the password field
?>
<?php
print drupal_render($form['submit']); // print the submit button
?>
<?php
print drupal_render($form); //print remaining form elements like "create new account"
?>

STAGE TWO

Step 3:
In your template.php add the following function
function zen_classic_theme(&$existing, $type, $theme, $path)
{
return array(
'user_login_block' => array (
'template' => 'user-login-block',
'arguments' => array('form' => NULL)
)
);
}

I replaced "Zen_classic_theme" with sardinia

Flushed the cache twice but no joy

Anybody achieved this or got any ideas

THANKS!

Tags:
Rob D.'s picture
Offline
Joined: 04/09/2008

Hey, sorry for the wait, customization requests have to go to the back of the pile...

Anyway, I think you may be over-thinking it a bit - you should be able to do this with CSS. Just go to Structure > Blocks and place the standard user login block that already exists in the Seconday Links region, underneath the Secondary Links block. Then, add the following CSS to the bottom of your stylesheet (you may want to tweak some things to get it exactly how you want it):

/** Changes to allow in-line User Login Form **/

#header-wrapper {
height: 120px
}

#secondary-links #user-login-form {
margin-top: 5px;
float: right;
}

#secondary-links #user-login-form .form-item {
margin: 0;
padding: 0;
padding-right: 5px;
float: left;
}

#secondary-links #user-login-form .form-item label {
display: none;
margin: 0;
padding: 0;
padding-right: 5px;
line-height: 20px;
font-size: 0.8em;
float: left;
}

#secondary-links #user-login-form .form-actions {
margin: 0;
padding: 0;
float: left;
}

#secondary-links #user-login-form .form-submit {
margin: 0;
padding: 0;
height: 23px;
}

#secondary-links #user-login-form .item-list {
font-size: 0.8em;
margin-top: -5px;
padding-left: 5px;
float: right;
}

Geoffbfc's picture
Offline
Joined: 06/23/2011

As ever, Rob and the Themeshark team come up with the answer

Great support, great themes and really grateful

Thanks

-------------------

Stanley Bloomfield

Support hours: 9AM - 5PM EST, Mon - Fri

Follow us on: