Cakephp’s Auth Component – user’s navigation panel

To create user’s navigation panel at the top of each page, default.ctp layout file has been changed. Inside ‘user-nav’ div, conditional statement has been added.
If user is logged in the ‘Welcome’ message, the user’s username and ‘Logout’ link are displayed. If user is logout, the two links are displayed: ‘Register’ and ‘Login’.
default_codes

The function _loggedIn() checks if user is logged in. If user is logged in, the function returns true, otherwise returns false.
loggedin_codes

If user is logged in not only the ‘Welcome’ message is displayed, but also the user’s username is displayed. The function _usersUsername() checks if user is logged in. If user is logged in, the function returns the user’s username.
usersusername_codes

The logged in user’s navigation panel at the top of the page with the ‘Welcome’ message, the user’s username and ‘Logout’ link:
loggedin

The non-logged in user’s navigation panel at the top of the page with the ‘Register’ and ‘Login’ links:
nonloggedin