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.

Username in visu
#2
Hi,

Only solution i know is by using a .lp file (in sample i named it user.lp) with this content:
Code:
<?
    require('apps')
    clientuser = request.username or 'anonymous'
    print(clientuser)
?>
Create a text object with custom class 'username' , enter a random text to position the element and add it to your visu.

Add this to custom css:
Code:
.username {
   display: none;
}

Enable password for user folder if you add the .lp file to the user folder (otherwise it shows 'anonymous') and put this into your custom javaScript:
Code:
$(function(){
  var xhttp = new XMLHttpRequest();
  xhttp.onreadystatechange = function() {
  if (xhttp.readyState == 4 && xhttp.status == 200) {
     var res = xhttp.responseText;
     if (typeof(res) !== "undefined" && res !== null){
        var UpperCaseRes = res.charAt(0).toUpperCase() + res.slice(1);
       $(".username").html(UpperCaseRes);
       $(".username").css("display","initial");
     }
   }
  };
  xhttp.open("GET", "/user/user.lp", true);
  xhttp.send();
});
BR,

Erwin
Reply


Messages In This Thread
Username in visu - by Thomas - 16.10.2017, 16:34
RE: Username in visu - by Erwin van der Zwart - 16.10.2017, 17:56
RE: Username in visu - by Thomas - 17.10.2017, 09:27
RE: Username in visu - by Thomas - 17.10.2017, 12:10
RE: Username in visu - by Erwin van der Zwart - 17.10.2017, 14:56
RE: Username in visu - by JohnTH - 05.02.2020, 11:22
RE: Username in visu - by admin - 05.02.2020, 12:06
RE: Username in visu - by JohnTH - 11.02.2020, 06:46
RE: Username in visu - by admin - 11.02.2020, 07:47
RE: Username in visu - by JohnTH - 11.02.2020, 10:53
RE: Username in visu - by admin - 11.02.2020, 10:56
RE: Username in visu - by JohnTH - 11.02.2020, 11:28

Forum Jump: