Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I want to remove the login link that is shown in the header so only myself can login by using www.mysite.com/user. The login block is set to none. How to do I remove that link? I do not know php code so if its hardcoded please explain how to do it. Thanks.
Comments
Comment #1
tombo CreditAttribution: tombo commentedRemove the following from page.tpl.php
if(!$logged_in) print l('log in', 'user/login');
In page, this will all be on one line.
Comment #2
pbm160 CreditAttribution: pbm160 commentedThanks for your help but I can't find this code in page.tpl.php. I looked in template.php which has something about login but not this line of code.
Here is template.php
Comment #3
pbm160 CreditAttribution: pbm160 commentedI found how to remove the login link. I deleted the following from the template.php. I hope it's OK.
// Display user account links.
$vars['user_links'] = _jackson_user_links();
//dpm($vars);
}
/**
* User/account related links.
*/
function _jackson_user_links() {
// Add user-specific links
global $user;
$user_links = array();
if (empty($user->uid)) {
$user_links['login'] = array('title' => t('Login'), 'href' => 'user');
// Do not display register link if registration is not allowed.
if (variable_get('user_register', 1)) {
$user_links['register'] = array('title' => t('Register'), 'href' => 'user/register');
}
}
else {
$user_links['account'] = array('title' => t('Hello @username', array('@username' => $user->name)), 'href' => 'user', 'html' => TRUE);
$user_links['logout'] = array('title' => t('Logout'), 'href' => "logout");
}
return $user_links;
Comment #4
pbm160 CreditAttribution: pbm160 commented