Hello,

I purchased a theme for a website:

http://ledleyfood.com

I would like to remove the login form block on the top of the page. I tried to remove the block in the block admin page but even though it is displayed as "none" the block is still displayed. My question is, how do I remove the block by editing the code? Do I edit the template.php file? Below is the template.php code if that helps. Any help is greatly appreciated.

/**
  * This snippet catches the default login form and looks for your
  * custom user_login.tpl.php file in the theme folder
  */
/*function phptemplate_user_login($form) {
 $form['pass']['#description'] = 'password';
 $form['name']['#description'] = 'username';
 $form['name']['#size'] = 10; // change the size of the username form box
 $form['pass']['#size'] = 10; // change the size of the password form box
 $form['submit']['#value'] = 'Log out'; // change the login button text.

 return _theme004_callback('user_login', array('form' => $form));
}
function  _phptemplate_variables($hook, $vars) {
 global $user;
 switch($hook) {
         case 'page' :
       // SUPER IMPORTANT: These rules prevent you from crashing your server :-)
       if (arg(0) != "user" && $user->uid == "0") {
           $vars['user_login_form'] = user_login($msg = '');
       }
       break;
 }
 return $vars;
}*/
function custom_login_block() {
  $form = array(
    '#action' => url($_GET['q'], array('query' => drupal_get_destination())),
    '#id' => 'user-login-form',
    '#validate' => user_login_default_validators(),
    '#submit' => array('user_login_submit'),
  );
  $form['name'] = array('#type' => 'textfield',
    '#title' => t('Username'),
    '#maxlength' => USERNAME_MAX_LENGTH,
    '#size' => 15,
    '#required' => TRUE,
  );
  $form['pass'] = array('#type' => 'password',
    '#title' => t('Password'),
    '#maxlength' => 60,
    '#size' => 15,
    '#required' => TRUE,
  );
  $form['submit'] = array('#type' => 'submit', '#value' => t('Login'), );
  
  $items = array();
  if (variable_get('user_register', 1)) {
    $items[] = l(t('Create new account'), 'user/register', array('title' => t('Create a new user account.')));
  }
  $items[] = l(t('Lost password?'), 'user/password', array('title' => t('Request new password via e-mail.')));
  $form['links'] = array('#value' => theme('item_list', $items));
  return $form;
}

function theme098_user_bar() {
 global $user;                                                               
 $output = '';

 if (!$user->uid) {                                                          
   $output .= drupal_get_form('custom_login_block');                           
 }                                                                           
 else {                                                                      
   $output .= t('<p class="user-info">Hi !user, welcome back.</p>', array('!user' => theme('username', $user)));

   $output .= theme('item_list', array(
     l(t('Your account'), 'user/'.$user->uid, array('title' => t('Edit your account'))),
     l(t('Sign out'), 'logout')));
 }
  
 $output = '<div id="user-bar">'.$output.'</div>';
    
 return $output;
}
function theme098_menu_local_task($link, $active = FALSE) {
  return '<li '. ($active ? 'class="active" ' : '') .'><span><span>'. $link ."</span></span></li>\n";
}

Comments

cmsproducer’s picture

Are you using a generic (out of the box) theme or is this a custom theme? - I will answer assuming that you are using an out of the box theme:
If you disable the display region of the block (set to none), it should go away from the live site. I hope that when you said "none", you were not referring to the title setting, because in that situation just makes the block title go away but still displays the block.

If you are using a custom theme and the above does not solve the problem, then it seems that your themer manually embedded the search form or is writing the search block onto the *.tpl.php template files. Let me know how this goes

DougM-dupe’s picture

Thanks for your input. I'm using a custom theme not one out of the box and I believe it is as you said embedded into the form. In the case that it is embedded how would I remove. Do I edit the *.tpl.php template file(s)? Thanks again for your help. Would it be helpful if I posted any additional code? If so what code would be helpful?

medenfield’s picture

Doug - You'd want to remove the call to the user login from the code in your page.tpl.php file in your theme's folder.

DougM-dupe’s picture

Which line should I remove? Can I just remove the

DougM-dupe’s picture

I think I figured it out. I just removed the line.

print theme098_user_bar();

Is that correct?