Jump to content

Help With Making Login Horizontal


derekshull

Recommended Posts

I have this code:

 

<?php
// template.php code
function horizontal_login_block($form) {
$form['#action'] = url($_GET['q'], array('query' => drupal_get_destination()));
$form['#id'] = 'horizontal-login-block';
$form['#validate'] = user_login_default_validators();
$form['#submit'][] = 'user_login_submit';
$form['#prefix'] = '';
$form['#suffix'] = '';
$form['name'] = array (
					 '#type' => 'textfield',
					 '#prefix' => '',
					 '#suffix' => '',
					 '#maxlength' => USERNAME_MAX_LENGTH,
					 '#size' => 15,
					 '#required' => TRUE,
					 '#default_value' => 'Username',
					 '#attributes' => array('onblur' => "if (this.value == '') {this.value = 'Username';}", 'onfocus' => "if (this.value == 'Username') {this.value = '';}" ),
					 );
 $form['pass'] = array (
					 '#type' => 'password',
					 '#maxlength' => 60,
					 '#size' => 15,
					 '#required' => TRUE,
					 '#prefix' => '',
					 '#suffix' => '',
					 );
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array('#type' => 'submit', '#value' => 'Login');
return $form;
}
?>

 

Right now the Username and Password and Login button are vertical but I want to make them horizontal. Any idea how to accomplish this?

 

I have this calling it to the page:

 

<?php
 print login_bar();
 function login_bar() {
   global $user;
   if ($user->uid == 0) {
  $form = drupal_get_form('horizontal_login_block');
  // Drupal 7 uses a new function 'render'.
  return render($form);
   }
   else {
  return t('Welcome back ') . ucwords($user->name);
   }
 }
?>

Edited by derekshull
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.