Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.

[Done] Store username in vanilla's cookie?

edited October 2006 in Vanilla 1.0 Help
Hi there,

I'm using http://www.haveamint.com/forum/viewtopic.php?id=1688 and therefore I need the username to be stored with the vanilla-cookie - is there an easy way to do this?

Tanks!

Comments

  • A_J did the same thing earlier, have a look at his extension.
  • edited October 2006
    Thanks for the hint!

    I made a small "extension" out of a_j's bigger one :-)

    Get it here if you want (updated)
  • MarkMark Vanilla Staff
    edited October 2006
    That extension will break. You need more checks in there, and you definitely don't need to set the cookie on every page load. Try this:

    if ($Context->Session->UserID > 0 && ForceIncomingCookieString('your_cookie_name', '') != $Context->Session->User->Name) { setcookie ("your_cookie_name", $Context->Session->User->Name, time()+604800); }
  • Thanks Mark!

    Changed the code to what you've written - the first thing worked for me, but not very effective I think...
  • what exactly does this do ? any benefit to using it ?
  • bugs, see first post
This discussion has been closed.