When you have something that happens with a link, you need to look in the code for a hook_menu()
. Then you need to guess which module it is in. In this case, take a look at core User module:
function user_menu() {
$items['user/login'] = array(
'title' => 'Log in',
'access callback' => 'user_is_anonymous',
'type' => MENU_DEFAULT_LOCAL_TASK,
);
return $items;
}
Note the 'access callback' => 'user_is_anonymous',
line. This means that you can only do this if you are anonymous (ie, not logged in). This means that you should just be able to make a menu entry with "user/login" as the path, and the link will only show when you are logged out.