0

Is there a way to store data for separate users in Drupal without using sessions. I have previously used Drupal varibales. But it didin't work because the variable gets updated for every user (So whenever I access the variable it shows the last users details). I can't use sessions because I have a horizontally scaled server, so when the server is changed the sessions will be deleted.

Is there a way to do this exactly as the sessions but without sessions? I need to save users data in the browser temporarily.

  • 1
    You can store data in the browser client side, this is no problem, but Drupal without sessions? Not possible if you want that users can log in. See this duplicate topic about load balancing with sessions drupal.stackexchange.com/questions/41373/… – 4k4 Aug 6 '18 at 6:32
0

If you don't need your data server side, you could use cookies, using user_cookie_save. Or store your variables in window.localStorage (it's HTML5, see here for browser support) in your own javascript code/behavior, like :

function storePersistentValue() {

  //Check whether local storage is available or not

  if (window.localStorage) {

    window.localStorage.MyKey = "HTML 5 features";

  }

}

function getPersistentValue() {

  //Check whether local storage is available or not

  if (window.localStorage) {

    var text = window.localStorage.MyKey;

  }

}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.