The MU forums have moved to WordPress.org

Need a cookie(?) to span all MU blogs (4 posts)

  1. ThomasFlorimonte
    Member
    Posted 15 years ago #

    Hi! I'm not sure if I searched for the correct term but here's what I need: I'm using MU 2.6.5 setup with the blogname.site.com blogging format (where blogname changes the blog)
    All the blogs on this install of MU are a different comic books- Same theme with different content (different blog for each comic book). I need a way, thought I could set a cookie, to remember a bit of info across all the blogs as the reader switches from blog to blog / comic to comic (all on the same install of MU). What I've got is a simple sidebar shopping cart system that displays what's in the cart by parcing a string var (cookie). I've built into the theme a "ADD COMIC TO CART" button that once clicked, adds a bit of info to the string var (cookie) thus when the sidebar loads, parces the cookie and displays the cart content. Easy and works great. (I've got another Store site that processes the order when the reader is ready to check out. That all works.) What I can't figure out is keeping the cookie working when jumping from blog to blog within the same MU install. I know the system remembers logis (for commenting) from MU blog to blog but can't figure out how to implement this technique for my use. IS there another way??? I'm pulling my hair out trying to work this out :)

    Thanks for the help :)

    Thomas Florimonte
    thomas@infernostudios.com
    thomas@ka-blam.com
    http://www.ka-blam.com

  2. Indeedle
    Member
    Posted 15 years ago #

    What domain are you setting for the cookie?

    Eg you should set the cookie domain when you're setting it as .domain.tld instead of domain.tld

    That allows any site.domain.tld you've got to access the cookie.

  3. ThomasFlorimonte
    Member
    Posted 15 years ago #

    This sounds like what I need to do. I'm setting the cookie the old standard way (which is why I guess it's not working). I've added a little code to the index.php that if something gets added to the shopping card cookie, it does it there-
    php code:
    setcookie("shoppingcart","$cart",time()+60*60*24*30);
    The URL at the time would br-
    comicsbook.site.com
    So I need to pre defind the cookie to work through out mu. Where is this done? AND BIG THANKS for this help!!!

    Thomas Florimonte
    thomas@infernostudios.com
    thomas@ka-blam.com
    http://www.ka-blam.com

  4. ThomasFlorimonte
    Member
    Posted 15 years ago #

    :)
    setcookie("shoppingcart","$cart",time()+60*60*24*30,"/",".ka-blam.com");
    -not-
    setcookie("shoppingcart","$cart",time()+60*60*24*30);

    I missed the ,"/",".ka-blam.com"); part. :) All working now. Thanks for the push in the right direction.

    Thomas Florimonte
    thomas@infernostudios.com
    thomas@ka-blam.com
    http://www.ka-blam.com

About this Topic

  • Started 15 years ago by ThomasFlorimonte
  • Latest reply from ThomasFlorimonte