We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 35094
    • 25 Posts
    I am wondering if it is possible to log out a webuser without using a log out button?

    So instead of clicking on anything, loading any page that is outside of a certain group would contain a line of code that would terminate the logged in session.

    Please let me know if this is possible.

    Thanks!
      • 9207 ☆ A M B ☆
      • 2,475 Posts
      You could put a Snippet on those pages... e.g. build a template that is used for all pages that would log out the user, and inside that template, but your "forced-logout" snippet. Any time one of those pages is loaded, the Snippet could force any logged in users to be logged out. Have a look at the existing logout Snippet(s) to see how to enforce this.
        • 35094
        • 25 Posts
        Yes, that’s what I was thinking though I can’t code in PHP (next thing to learn). I looked at Login snippet but that is way too complicated for me to dechiper.

        If the snippet is quick to write could you give me an example?
          • 9207 ☆ A M B ☆
          • 2,475 Posts
          It’s simple... but not so simple I can spit out a quick example of it sad
            • 35094
            • 25 Posts
            No probs!

            I want to start learning php soon so I hope eventually I will get a better grasp of the whole thing.

            Thanks!
              • 32316
              • 387 Posts
              Can I ask ’Why?’

              if a user opens another page on the site in a new tab, or window they are going to be logged out - possibly annoying
              if a user merely closes the window or just surfs to a different site they will not be logged off...