Page 1 of 3 123 LastLast
Results 1 to 10 of 24
  1. #1
    Join Date
    Feb 2007
    Posts
    819
    Plugin Contributions
    0

    Default log off link - how do I make it only appear when logged on?

    Hi,

    Right now I have Log Off as permanent link in the nav bar. But how do I make that link only appear if someone is actually logged on?

    Thanks!

  2. #2
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,263
    Plugin Contributions
    3

    Default Re: log off link - how do I make it only appear when logged on?

    What did you do to get it to display as a permanent link in the first place?
    20 years a Zencart User

  3. #3
    Join Date
    Feb 2007
    Posts
    819
    Plugin Contributions
    0

    Default Re: log off link - how do I make it only appear when logged on?

    It is in ezpages (page title Logoff) with yes to appear in the header and footer and an internal link to the logoff page.

    What I would like to do is only have that link appear if someone is actually logged on.

    Thanks.

  4. #4
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: log off link - how do I make it only appear when logged on?

    You can surround the code for that link with an if test like

    if ($_SESSION['customer_id']) {
    ... link code ...
    }

  5. #5
    Join Date
    Feb 2007
    Posts
    819
    Plugin Contributions
    0

    Default Re: log off link - how do I make it only appear when logged on?

    Cool. Where do I put that bit of code?

    Code:
     
    if ($_SESSION['customer_id']) {
    index.php?main_page=logoff
    }
    Thanks

  6. #6
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: log off link - how do I make it only appear when logged on?

    Actually it may be a bit tricky.

    You would put the if test around the entire code that outputs the link, not just the url snippet; but since this is an ez-pages menu, it is dynamic and there is not a fixed bit of code in the file to apply the switch to.

    It might work to test the page ids as they are being processed by the output file(s) and skip the output if the current id is the same as the logoff page id. More research needs to be done for this.

  7. #7
    Join Date
    Feb 2007
    Posts
    819
    Plugin Contributions
    0

    Default Re: log off link - how do I make it only appear when logged on?

    Whoa... that sounds quite a bit more tricky. I was hoping I could just do something similar to the view cart and checkout now links which only appear the nav bar if something is placed in the cart...

    Still, it seems like a handy piece of code (having log off only appear if someone is actually logged on)...

    Thanks.

  8. #8
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: log off link - how do I make it only appear when logged on?

    That code would be easy to apply to any element in the header navbar, because the link code is individually spelled out in the file. It is the same principle as is currently used in the header navbar area. Unfortunately, #navCatTabs and #navEZPagesTop are dynamic.

  9. #9
    Join Date
    Feb 2007
    Posts
    819
    Plugin Contributions
    0

    Default Re: log off link - how do I make it only appear when logged on?

    Yeah I can see where that might throw a wrench in the works. Oh well... it was a good thought. :-)

    Thanks.

  10. #10
    Join Date
    Jun 2003
    Posts
    33,715
    Plugin Contributions
    0

    Default Re: log off link - how do I make it only appear when logged on?

    What's the URL?
    Please do not PM for support issues: a private solution doesn't benefit the community.

    Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

 

 
Page 1 of 3 123 LastLast

Similar Threads

  1. How do i make banner ads appear on the front page only?
    By mjw2305 in forum Basic Configuration
    Replies: 65
    Last Post: 9 Mar 2012, 06:04 PM
  2. Link only show when logged in
    By twdhosting in forum Templates, Stylesheets, Page Layout
    Replies: 11
    Last Post: 16 Aug 2010, 01:12 AM
  3. More Information Sidebox to appear only when logged in
    By mathgyrl in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 10 Jan 2008, 08:25 PM
  4. How do I make my logo only appear on the main page
    By CafePrima in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 27 Oct 2007, 07:00 PM
  5. Replies: 1
    Last Post: 30 May 2006, 06:51 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR