I need to display a custom login bar on my right-side-bar but get a WSOD instead. Based on the tutorials at http://drupal.org/node/350634 and http://drupal.org/node/92657 I have the following in my template.tpl.php. Though there are functions for user registrations and user password in my code below, they can be ignored since my question is only about displaying the login bar

<?php
function lw_theme() {
  return array(
   
'user_login' => array(
     
'template' => 'user-login',
     
'arguments' => array('form' => NULL),
    ),
   
'user_register' => array(
     
'template' => 'user-register',
     
'arguments' => array('form' => NULL),
    ),
   
'user_pass' => array(
     
'template' => 'user-pass',
     
'arguments' => array('form' => NULL),
    ),
  );
}

function
lw_preprocess_user_login_block(&$variables) {
 
$variables['intro_text'] = t('');
 
//I don't need to display the text hence I have empty quotes
 
$variables['rendered'] = drupal_render($variables['form']);
 
}

function
lw_preprocess_user_register(&$variables) {
 
$variables['intro_text'] = t('Billions of blue blistering boiled and barbecued barnacles! You aren''t registered yet');
 
$variables['rendered'] = drupal_render($variables['form']);
}

function
lw_preprocess_user_pass(&$variables) {
 
$variables['intro_text'] = t('This is my super awesome insane password form');
 
$variables['rendered'] = drupal_render($variables['form']);
}

function
lw_user_bar() {
 
// This creates the bar
 
global $user;
 
$output = '';
 
// Check if user is NOT logged in
 
if (!$user->uid) {
   
$output .= drupal_get_form('user_login_block');
  }
  else {
   
$output .= t('<p class="user-info">Cachinnating cockatoo!, welcome back.</p>', array('!user' => theme('username', $user)));
   
$output .= theme('item_list', array(
     
l(t('Your account'), 'user/'.$user->uid, array('title' => t('My account'))),
     
l(t('Sign out'), 'logout')));
  }
 
$output = '<div id="user-bar">' . $output . '</div>';
  return
$output;
}
?>

In my page-front.tpl.php I have the following

<?php
 
if (!empty($right)):
?>
<?php
 
print lw_user_bar()
?>
<?php
 
print $right;
?>
<?php
 
endif;
?>

In the blocks configuration I have just enabled the search bar to be displayed on the right-side-bar. Ideally the login bar should appear in the right-side-bar followed by the search bar below it. But for some reason I get a WSOD. Does anyone know what could be wrong? Any help would be appreciated.