ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Storing session data

November 28, 2011 5:02am

Subscribe [6]
  • #1 / Nov 28, 2011 5:02am

    Est Digital

    62 posts

    What is the best place to store session data?

    I’ve tried storing data in the Session userdata, but it isn’t remembered. There’s also a cache array, but I’m afraid the data might be removed at some point.

    I’ve also tried storing it in $_SESSION, but it seems to get cleared while you’re still logged in.

  • #2 / Nov 29, 2011 1:40am

    John Henry Donovan

    12339 posts

    Hi Kees Internet,

    Can you explain with some context and examples what you are trying to do please?

    Also take a look at the Session Variables Plugin

  • #3 / Nov 30, 2011 3:20am

    Est Digital

    62 posts

    Could it have to do with cookie login?

    Since you can login using cookies or session I wonder how you can store data with it. Should I use PHP’s native $_SESSION or does EE have a class for it?

    I’m trying to remember a search filter for both members and guests in a custom plugin.

     

  • #4 / Nov 30, 2011 3:25am

    John Henry Donovan

    12339 posts

    Hi Kess,

    that add-on leverages PHP’s native $_SESSION

    EE does have a Session Class though. From reading your initial post though I presumed you had already found it in the docs

  • #5 / Nov 06, 2012 8:29pm

    96black

    26 posts

    That didn’t really answer what the best practice for adding session data was.

    There is no ability to add session information through EE’s session class from what I can see. This functionality is readily available in CodeIgniter’s session class but has been removed in EE (I can’t understand why).

    If we’re wanting to store information… do we really have to fall back onto php’s native sessions?

    For context, what are we supposed to do if we have a multi stage registration process or something like that where we need to be able to pass information through a few different pages?

    Thanks

  • #6 / Nov 07, 2012 4:44pm

    Dan Decker

    7338 posts

    Hi 96black,

    It looks like you are looking for the cache array() in the Session Class.

    Cheers,

  • #7 / Nov 07, 2012 9:42pm

    96black

    26 posts

    Hi 96black,

    It looks like you are looking for the cache array() in the Session Class.

    Cheers,

    Hey Dan. Thanks for getting back to me.
    I’m unsure whether or not that is going to be the solution. I was put off by referring to the data as “flash data”. IE if you are wanting to store more information about a signed in user, or for example in a case more relevant to my work, a persistent, serialised object containing e.g. patient information related to a member (but not stored in the system, from an external source) etc.

    That isn’t my understanding of the definition of flash data. To me that is data which is used once on the next page then removed from the session (based on my CodeIgniter experience).

    I will have a play in the next couple of days and see if that works that way. Thanks Dan.

  • #8 / Nov 08, 2012 3:21pm

    Shane Eckert

    7174 posts

    Hey 96,

    Sounds good. Please let us know how things go!

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases