We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Cookie plugin not working

Development and Programming

Michael Backes's avatar
Michael Backes
15 posts
17 years ago
Michael Backes's avatar Michael Backes

Hi, I am able to set cookies using php, but I have some logic in EE tags that I wanted to pull the cookie out using the plugin, but I can not seem to get it to read or set any cookies. Does anyone know a trick to make the plugin work?

Thanks, Michael

       
Daniel Walton's avatar
Daniel Walton
553 posts
17 years ago
Daniel Walton's avatar Daniel Walton

Post up some code, without that it’s hard to say where the cause of the problem stems 😊

       
Michael Backes's avatar
Michael Backes
15 posts
17 years ago
Michael Backes's avatar Michael Backes

Well, I was pretty much using the default code in the plugin text:

In the page, I have an if statement, based upon if there is a segment_2. If there is one, then I go through, grab the appropriate blog and want to set the cookie with:

{exp🍪store name="mycoach" value="x” seconds=“3600"}

if there is no segment_2, then I want to use the cookie to get something out of the db using a query. So I pull the cookie using:

{exp🍪retrieve name="mycoach"}

I have tried a few different things to get the data out, but when that didn’t work, I went to the browser and went looking for the cookie at the time I set it. The cookie does not show up. If I create some php code in the page, then the cookie gets set. So I am thinking maybe it’s a problem with the plugin not working right. But there’s not a lot to the plugin, or the underlying php code. I am hoping that maybe there is a simple setting somewhere or a step I missed.

Thanks!

       
DEA's avatar
DEA
257 posts
17 years ago
DEA's avatar DEA

Same issue here. The plugin sets the cookie fine, but can’t read it. In fact, I don’t even see any functions in the EE classes to get cookie values back out.

       
Jamie Poitra's avatar
Jamie Poitra
409 posts
17 years ago
Jamie Poitra's avatar Jamie Poitra

There is no COOKIE specific retrieval function but the Input class should be able to retrieve a cookie like this:

$IN->GBL('cookie_name', 'COOKIE');

Cookies are notably domain specific though. A browser won’t give up one domain’s cookie to a page on another domain. You aren’t trying to do that are you?

Jamie

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.