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);
   }
 }
?>

Link to comment
https://forums.phpfreaks.com/topic/269544-help-with-making-login-horizontal/
Share on other sites

This seems to be third party framework functions, specifically Drupal 7. Which means you've posted in the wrong section, and that you should have made a mention of this from the start, instead of me having to guess so on the basis of a comment in the code.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.