21286 Posts in 5733 Topics by 2602 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1307 Views |
-
Member-specific session data

27 May 2010 at 12:25pm Last edited: 27 May 2010 12:26pm
I'm currently using silverstripe's built in member management functions to log users in and out so that they can see various areas of front-end templates available to logged-in users only.
I also need to store additional data for logged in members in a session (wishlist/cart items). Is there a member-specific session that I can use/add to that will be automatically destroyed on logout?
Alternatively, what other ways can I do this?
-
Re: Member-specific session data

27 May 2010 at 12:53pm
You can use the Session class to store values tied to a session. Another less secure / robust way is using cookies.
Session::set('MyValue', 2);
Session::get('MyValue');http://api.silverstripe.org/2.4/sapphire/control/Session.html
http://api.silverstripe.org/2.4/sapphire/misc/Cookie.html -
Re: Member-specific session data

27 May 2010 at 1:10pm
Thanks Willr.
Could you give me a specific example of how I could tie a value in with the member session -- sorry, haven't worked much with sessions in SS. -
Re: Member-specific session data

27 May 2010 at 2:10pm
Ask and you shall receive! I've done up a documentation page explaining it and examples on how to use it.
| 1307 Views | ||
|
Page:
1
|
Go to Top |


