Options

Can I hide the search and browse link when I'm logged out?

spider-tspider-t Registered Users Posts: 443 Major grins
edited August 25, 2013 in SmugMug Customization
I'd like to have the search and browse link visible on only when I'm logged in. Is that something I can do?

thanks!
Trish

Comments

  • Options
    denisegoldbergdenisegoldberg Administrators Posts: 14,244 moderator
    edited August 13, 2013
    Have you considered leaving these links off of your navbar? You can always type the URL when you are logged on to get to those pages. (Of course that doesn't stop your viewers from doing the same thing.)

    I'd like to think that someone will (or has) come up with the URL to hide navbar entries when you are not logged in.

    --- Denise
  • Options
    thenickdudethenickdude Registered Users Posts: 1,302 Major grins
    edited August 13, 2013
    I'd like to think that someone will (or has) come up with the URL to hide navbar entries when you are not logged in.

    --- Denise

    You can do that with CSS like this:
    /* Hide page link for general users: */
    .sm-page-widget-nav a[href$="/About-me"] {
        display:none;
    }
    
    /* But show it if I'm logged in: */
    .sm-user-loggedin .sm-page-widget-nav a[href$="/About-me"] {
        display:inline;
    }
    

    Just change the "/About-me" to the address of the page you want to hide (e.g. "/search" or "/browse"). Although it's pretty hard to hide "browse" since it appears on your default breadcrumb navigation bars.
  • Options
    denisegoldbergdenisegoldberg Administrators Posts: 14,244 moderator
    edited August 13, 2013
    Lamah wrote: »
    You can do that with CSS like this:
    /* Hide page link for general users: */
    .sm-page-widget-nav a[href$="/About-me"] {
        display:none;
    }
    
    /* But show it if I'm logged in: */
    .sm-user-loggedin .sm-page-widget-nav a[href$="/About-me"] {
        display:inline;
    }
    

    Just change the "/About-me" to the address of the page you want to hide (e.g. "/search" or "/browse"). Although it's pretty hard to hide "browse" since it appears on your default breadcrumb navigation bars.
    Thanks! It's always good to know where to find this code when someone asks.

    I'm not sure what you mean by browse appearing on default breadcrumb nav bars. Doesn't that depend on the OP placing browse in the navbar? On my site I don't have /browse in the navbar. Yes, someone can enter that in the URL, but as soon as a folder or gallery is clicked there is no browse entry in the breadcrumb.

    --- Denise
  • Options
    thenickdudethenickdude Registered Users Posts: 1,302 Major grins
    edited August 13, 2013
    That's odd, I could have sworn that Browse was on the breadcrumbs, but now that I try it, the home icon definitely takes me to the index page. I guess I just remembered wrong!
  • Options
    PilotBradPilotBrad Registered Users Posts: 339 Major grins
    edited August 25, 2013
    This worked great for me to hide the "Browse" link from visitors.

    I then realized the changes didn't have an effect on the mobile site, so I added the following CSS and it it also suppressed it there too. You will need change "browse" to the menu item you are trying to hide.
    /* HIDE BROWSE LINK ON MOBILE SITE */
    @media screen and (max-width: 640px) {
       .sm-accordion-item.sm-nav-item-toplevel a[href$="/browse"] {
         display:none;
      }
    }
    
    /* SHOW BROWSE LINK WHEN LOGGED IN ON MOBILE SITE */
    @media screen and (max-width: 640px) {
       .sm-user-loggedin .sm-accordion-item.sm-nav-item-toplevel a[href$="/browse"] {
         display:inline;
      }
    }
    
  • Options
    denisegoldbergdenisegoldberg Administrators Posts: 14,244 moderator
    edited August 25, 2013
    Keep in mind that others who know that browse and search exist can simply enter those pages via the browser's URL input location. The CSS above hides them from the visible menu (only).

    --- Denise
  • Options
    carolinecaroline Registered Users Posts: 1,302 Major grins
    edited August 25, 2013
    Why would you want to hide the About-Me :)

    Caroline
    Mendip Blog - Blog from The Fog, life on the Mendips
    www.carolineshipsey.co.uk - Follow me on G+

    [/URL]
  • Options
    PilotBradPilotBrad Registered Users Posts: 339 Major grins
    edited August 25, 2013
    The CSS above hides them from the visible menu (only).

    Yes, exactly! As I said it hides the "link", not the page. This useful not for preventing access to content (there are other tools for that) but for guiding a visitors experience.
Sign In or Register to comment.