From 3e769286d2b07347f15218642e55b3b1aec8e8cc Mon Sep 17 00:00:00 2001 From: Josh Sherman Date: Mon, 16 Dec 2013 22:19:32 -0500 Subject: [PATCH] Added logout to the header Displaying options based on if the user is authenticated or not. --- modules/login.php | 1 - templates/__shared/index.phtml | 12 ++++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/modules/login.php b/modules/login.php index 1578df8..273f87e 100644 --- a/modules/login.php +++ b/modules/login.php @@ -2,7 +2,6 @@ class login extends AnonymousModule { - } ?> diff --git a/templates/__shared/index.phtml b/templates/__shared/index.phtml index b571d44..1d77faa 100644 --- a/templates/__shared/index.phtml +++ b/templates/__shared/index.phtml @@ -48,10 +48,18 @@ '/' => 'Home', '/about' => 'About', '/contact' => 'Contact', - '/login' => 'Sign in', - '/join' => 'Sign up', ); + if (User::isAuthenticated()) + { + $links['/logout'] = 'Logout'; + } + else + { + $links['/login'] = 'Sign in'; + $links['/join'] = 'Sign up'; + } + foreach ($links as $uri => $label) { $active = '';