This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

User specific default window
#2
Hi,

You can fetch his/her login username and showPlan(x) based on username with custom JavaScript.

Put this in a file called user.lp inside your ftp user folder:
Code:
<?
  require('apps')
  clientuser = request.username or 'anonymous'
  print(clientuser)
?>
Put this in your custom JS:
Code:
$(function(){
  var xhttp = new XMLHttpRequest();
  xhttp.onreadystatechange = function() {
     if (xhttp.readyState == 4 && xhttp.status == 200) {
        var res = xhttp.responseText;
         res = res.trim();
         if (typeof(res) !== "undefined" && res !== null){
            if (res == 'erwin'){
               showPlan(1);
            }
            if (res == 'admin'){
               showPlan(2);
            }
         }
     }
  };
  xhttp.open("GET", "/user/user.lp", true);
  xhttp.send();
});
BR,

Erwin
Reply


Messages In This Thread
User specific default window - by Thomas - 20.12.2017, 22:28
RE: User specific default window - by Erwin van der Zwart - 20.12.2017, 23:35
RE: User specific default window - by Thomas - 21.12.2017, 11:20

Forum Jump: