Psycho Posted December 28, 2011 Share Posted December 28, 2011 I assume the Login/Registration links are included in the body_header.inc.php file which is called from many different other files. So, just set a var (or vars) that you can use to determine if you will show the Login/Registration links or not - or other content (or not). You already know that you will use the user's logged in status as ONE determination for displaying those links the My Account/Log out links. So, you need another variable to determine when NOT to show the Login/Registration links and NOT to show the logout links (i.e. during registration.). So, in pages that you don't want to show the login/registration links create a var for this. Persoanlly I prefer to set the default value for such a var in my config script that is loaded in all pages and then set it to the non-default value as needed. That way I don't have to worry about checking isset() all over the place. But, let's say you only set it on the pages where you do NOT want to show the login/registration links. Just use: $noLogin = true; Then in the page to create your header links, use something like this: if(isset($loggedIn) && $loggedIn) { //Show logout / my account links } elseif(isset($noLogin) && $noLogin) { //Show any links/text on the registration pages } else { //Show login / registration links } Quote Link to comment Share on other sites More sharing options...
doubledee Posted December 28, 2011 Author Share Posted December 28, 2011 Well i guess point 1 you arent logged in yet so thats kinda superfluous. Point 2 you wouldnt be either but IMO you should show it on that page. And the others work under logged in status logic so really the only thing is first point. Well, not to be anal-retentive, but... > - Creating an Account You don't have an Account so you can't log-in and you are already creating an account so that doesn't apply either. Strike the Welcome Masts. > - Logging In (on the actual Log In page) You aren't logged in so don't show logged in messages and you are in the process of logging in so don't show log-in because you are logging in! > - At the "Create Account Results" page I have a Log-In button on that page so you don't need it in the Header > - Changing Your Password I guess here you can show "Hello, Debbie" > - Resetting Your Password You clearly don't know your password so you can't be logged in and don't know how to log in so why show the option? And you don't need an account because you just locked yourself out of one... > - Checking Out Are you going to give me your $$$ or screw around creating another account or logging in and out for giggles??? Follow me?! Debbie Quote Link to comment Share on other sites More sharing options...
doubledee Posted December 28, 2011 Author Share Posted December 28, 2011 I assume the Login/Registration links are included in the body_header.inc.php file which is called from many different other files. So, just set a var (or vars) that you can use to determine if you will show the Login/Registration links or not - or other content (or not). You already know that you will use the user's logged in status as ONE determination for displaying those links the My Account/Log out links. So, you need another variable to determine when NOT to show the Login/Registration links and NOT to show the logout links (i.e. during registration.). So, in pages that you don't want to show the login/registration links create a var for this. Persoanlly I prefer to set the default value for such a var in my config script that is loaded in all pages and then set it to the non-default value as needed. That way I don't have to worry about checking isset() all over the place. Good points. Here is what I did in Release #1... <div id="header"> <a href="<?php echo WEB_ROOT ?>index.php"> <img id="logo" src="" /> </a> <?php // CHECK FOR LOGABLE PAGES. if (!($page == 'log_in.php') && !($page == 'log_in_c.php') && !($page == 'create_account.php') && !($page == 'build_profile.php') && !(substr($page, 0, 12) == 'activate.php') && !($page == 'add_article.php') && !($page == 'process_reset.php') && !($page == 'reset_password.php') ){ // Logable Pages. $firstName = (isset($_SESSION['memberFirstName']) ? $_SESSION['memberFirstName'] : ''); if (isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] == TRUE){ // Member Welcome. echo '<p id="welcome"> <span class="orangeBold">Hello, ' . $firstName . '!!</span> </p>'; echo '<ul id="accountMenu"> <li><a href="#">My Account</a></li> <li class="last"><a href="#">Help</a></li> <li class="last"><a href="/log_out.php">Log Out</a></li> </ul>'; }else{ // Visitor Welcome. echo '<p id="welcome"> <span class="orangeBold">Hello.</span> <a href="/log_in.php">Sign In</a> to access member-only features and content. Not a Member? <a href="/create_account.php">Start Here</a> </p>'; }// End of WELCOME MESSAGE. }// End of CHECK FOR LOGABLE. Sincerely, Debbie Quote Link to comment Share on other sites More sharing options...
Psycho Posted December 28, 2011 Share Posted December 28, 2011 I think you are thinking too hard on this. A little context specific content is a good thing, but going overboard just makes it way too complicated. And complicated = more bugs and harder to maintain. Plus, some of the scenarios you think are valid may not be. > - Creating an Account Why not show the login page. What if the person got here accidentally by clicking the wrong link. Instead of forcing the user to hit the back button and then click login, they could simply click login from this page. > - Resetting Your Password Again, why wouldn't you show the login link here. What if the user came here by accident OR after clicking the link to come here they suddenly remembered what their password is or (more likely) found the sticky note with their password? Don't make things more complicated than you need to lest you venture down the hole after the white rabbit. Some things are no brainers. If the user is logged in then you shouldn't show the login or create account links. But, you should show the logout link. But if the user is not logged in, there really isn't any harm in displaying the Login and Create Account links on any of the pages - even the login page and the create account page. If the user clicks them it will only take them back to the form. no data is submitted or saved to the database. If you really want to tailor the headers/available links for some of the "management" pages, then consider using different header includes on those specific pages instead of over-complicating your main header. Quote Link to comment Share on other sites More sharing options...
doubledee Posted December 29, 2011 Author Share Posted December 29, 2011 I think you are thinking too hard on this. It's what I do best?! A little context specific content is a good thing, but going overboard just makes it way too complicated. And complicated = more bugs and harder to maintain. Plus, some of the scenarios you think are valid may not be. > - Creating an Account Why not show the login page. What if the person got here accidentally by clicking the wrong link. Instead of forcing the user to hit the back button and then click login, they could simply click login from this page. > - Resetting Your Password Again, why wouldn't you show the login link here. What if the user came here by accident OR after clicking the link to come here they suddenly remembered what their password is or (more likely) found the sticky note with their password? Don't make things more complicated than you need to lest you venture down the hole after the white rabbit. Some things are no brainers. If the user is logged in then you shouldn't show the login or create account links. But, you should show the logout link. But if the user is not logged in, there really isn't any harm in displaying the Login and Create Account links on any of the pages - even the login page and the create account page. If the user clicks them it will only take them back to the form. no data is submitted or saved to the database. If you really want to tailor the headers/available links for some of the "management" pages, then consider using different header includes on those specific pages instead of over-complicating your main header. Some more good points. I'll need to sleep on it, but you may be right. Thanks for all of the help, guys!! Debbie Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.