Hi,
I think this is more simple and helped me alot.
// mysite/code/Page.php -> Page_Controller
public function IsLoggedIn(){
if(Member::currentUserId()){
return true;
}
}
public function CurrentUser(){
return Member::currentUser();
}
// In your template File
<% if IsLoggedIn %>
<li id="logged-in" class="mainmenu">
<% control CurrentUser %>
<span>You are logged in as </span>
<strong>
<% if FirstName && Surname %>
$FirstName $Surname
<% else_if FirstName %>
$FirstName
<% else %>
$Email
<% end_if %>
</strong>
(<a href="Security/logout" id="LogoutLink">Logout</a>)
<% end_control %>
</li>
<% else %>
<li id="login" class="mainmenu"><a href="Security/login?BackURL=$Link">Login</a></li>
<% end_if %>
:)