We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4494
    • 12 Posts
    I’m not sure this is the right forum, but it’s not clear to me which forum is.
    Anyway, how can one modify the duration of the cookies created by the weblogin snippet? My users are lazy and don’t want them to expire in one hour, as they seem to do right now.
    By the way, where can I find documentation about the vanilla snippets?

    Thanks for the help.
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      This is an issue with your server and how PHP is configured. It has little or nothing to do with the cookies, but with the PHP session garbage collection.

      You can set up your session_save_path to something other than the default, and the global session garbage collector won’t remove them at all; in that case you have to have a mechanism for clearing up old session files yourself.

      There are hacks and workarounds involving javascript timers calling for images at regular intervals to keep the session alive.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 4494
        • 12 Posts
        Ok. I have found some good information at http://www.captain.at/howto-php-sessions.php, but I’m not sure where to put this PHP code. I even can’t find the word ’session’ anywhere. And editing index.php, where I did find ’ini_set’, somehow doesn’t seem like a good idea to me.

        I plan on adding
        ini_set('session.gc_maxlifetime', $garbage_timeout); //changes the lifetime of sessions so the garbage collector doesn't clean them up sooner then we want to

        and
        ini_set('session.save_path', $sessdir); //sets the session save path to a different directory, so the garbage collectors of other php pages doesn't clean up these sessions

        I want to add those to a page of the site, so it will only affect these sessions.
        Where should I add this code?
          • 22303 MODX Staff
          • 10,725 Posts
          For now, you can add those to the startCMSSession function in the manager/includes/config.inc.php. Just be aware that anytime you run an upgrade, you’ll need to add that back to the config file. In addition, future releases (0.9.7+) will include system settings to configure these and many other session configuration variables, as well as the ability to provide a custom session handler class.
            • 4494
            • 12 Posts
            Quote from: OpenGeek at Apr 13, 2007, 10:30 AM

            For now, you can add those to the startCMSSession function in the manager/includes/config.inc.php. Just be aware that anytime you run an upgrade, you’ll need to add that back to the config file. In addition, future releases (0.9.7+) will include system settings to configure these and many other session configuration variables, as well as the ability to provide a custom session handler class.
            Wow, great, thanks smiley