+ Reply to Thread
Results 1 to 5 of 5

Thread: javascript login and get uservariables

  1. #1
    Junior Member
    Join Date
    Dec 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    javascript login and get uservariables

    Hello
    i try to login electroserver with javascript. login part is ok. i can login with username and password but when try to get user variables with the code "es.managerHelper.userManager.me.userVariableByNam e" it's return nothing.

    how i can get user variables with javascript after login ?

    Thanks.

  2. #2
    Former Administrator tcarr's Avatar
    Join Date
    Dec 2007
    Posts
    7,709
    Thanks
    84
    Thanked 1,178 Times in 1,165 Posts
    What version of the ES5 javascript client are you using?
    Teresa Carrigan
    Senior Software Developer
    Janus Research Group, Inc.
    previously
    Senior Engineer
    Electrotank, Inc.

  3. #3
    Junior Member
    Join Date
    Dec 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i use ElectroServer-5-Client-JavaScript and ElectroServer_5_3_1.

  4. #4
    Former Administrator tcarr's Avatar
    Join Date
    Dec 2007
    Posts
    7,709
    Thanks
    84
    Thanked 1,178 Times in 1,165 Posts
    Are you sure you have a UserVariable already with that name? I have a test client that works, after getting the User object (u) from UserManager, and if there is a UserVariable named "av":
    Code:
            var uv = null;
            log("userVariableByName");
            uv = u.userVariablesByname["av"];
            log("got the uv");
            if (uv != null) {
              log("uv != null");
              avName = uv.value.getString("av");
              log("getString");
            }
    Try something in this format, with logging to make sure that your me User object is not null, and tell me which logging lines worked, so we know where it fails. Another thing to try is to take the array from u.userVariables and iterate through all of this user's user variables (which is what we had to do a couple of releases ago because userVariableByName was broken - are you sure that you are using the 5.3.1 version of the Javascript api?).

    How are you setting the user variable? Perhaps that's not being done correctly. There are multiple ways to set a user variable (in login request, by the login event handler, by a plugin, with an UpdateUserVariableRequest). Of course if the ES Admin's user permissions has the ability for a user to set his own user variable turned off, then only the ones on the server side will work.

    edit: are you in a room that has user variable events turned off? That might interfere as well.
    Teresa Carrigan
    Senior Software Developer
    Janus Research Group, Inc.
    previously
    Senior Engineer
    Electrotank, Inc.

  5. #5
    Junior Member
    Join Date
    Dec 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Okay. Thank you so much.
    it's working when i use value.getString() it was a syntax problem

    Thanks

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts