We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 11713
    • 11 Posts

    to login to my site i use the weblogin snippet, so in my private pages i want to know : if the visitor is logged in or not?

    is there a session variable like $_SESSION[’is_connected’]? or there is another way to know that?

    Thank you
      • 17531
      • 3 Posts

      I don’t know if have a more specific solution, but this resolve that.

      paste this code in the end of weblogin plugin
      if((!isset($_SESSION['webValidated'])) && $_REQUEST['id']<>463){ echo "<script>window.location='index.php?id=463'</script>"; }

      if the variable $_SESSION[’webValidated’] it’s blank, so the user don’t logged in. In this example, if the user don’t logged in going to the login page (id=463)

      Sorry for my english, I hope help you.

      Louis Monteiro
        • 4971
        • 964 Posts
        There is a PHx modifier that checks for web user logged in
        and then gives the option to go to a chunk or string if it
        is and to another one if the user is not logged in.

        Hope it helps...
          Website: www.mercologia.com
          MODX Revo Tutorials:  www.modxperience.com

          MODX Professional Partner
          • 3749
          • 24,544 Posts
          The Personalize snippet will also do that. It shows one chunk to logged-in users and another to the rest.
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting