<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>themeDisplay.getUserName() is not working in javascript</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=119172434" />
  <subtitle>themeDisplay.getUserName() is not working in javascript</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=119172434</id>
  <updated>2026-04-04T11:02:07Z</updated>
  <dc:date>2026-04-04T11:02:07Z</dc:date>
  <entry>
    <title>RE: themeDisplay.getUserName() is not working in javascript</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119261679" />
    <author>
      <name>Kailash Yadav</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119261679</id>
    <updated>2020-05-28T09:32:54Z</updated>
    <published>2020-05-28T09:32:54Z</published>
    <summary type="html">Hi Varun,You can get user name in javascript as following :&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;var r = /\\u([\d\w]{4})/gi;&lt;br /&gt;var userName = themeDisplay.getUserName().replace(r, function (match, grp) {&lt;br /&gt;    return String.fromCharCode(parseInt(grp, 16)); } );&lt;br /&gt;console.log(userName);</summary>
    <dc:creator>Kailash Yadav</dc:creator>
    <dc:date>2020-05-28T09:32:54Z</dc:date>
  </entry>
  <entry>
    <title>RE: themeDisplay.getUserName() is not working in javascript</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119222142" />
    <author>
      <name>Olaf Kock</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119222142</id>
    <updated>2020-05-23T09:30:41Z</updated>
    <published>2020-05-23T09:30:41Z</published>
    <summary type="html">&lt;div class="quote-title"&gt;Varun Gupta:&lt;/div&gt;&lt;blockquote&gt;&lt;br /&gt;Hi Olaf,Thanks for the reply.I am using Liferay 7.2 Sp1 EE. I am trying  to get username in main.js and it is returning unicode value for username. It should give proper username instead of Unicode string.&lt;br /&gt;&lt;/blockquote&gt;Being on DXP 7.2 SP1 (there&amp;#39;s no more EE, just DXP vs CE) makes this a great quick description for filing a ticket with the support team.</summary>
    <dc:creator>Olaf Kock</dc:creator>
    <dc:date>2020-05-23T09:30:41Z</dc:date>
  </entry>
  <entry>
    <title>RE: themeDisplay.getUserName() is not working in javascript</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119209054" />
    <author>
      <name>Varun Gupta</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119209054</id>
    <updated>2020-05-21T12:31:35Z</updated>
    <published>2020-05-21T12:31:35Z</published>
    <summary type="html">Hi Olaf,Thanks for the reply.I am using Liferay 7.2 Sp1 EE. I am trying  to get username in main.js and it is returning unicode value for username. It should give proper username instead of Unicode string.&lt;br /&gt;Thanks..</summary>
    <dc:creator>Varun Gupta</dc:creator>
    <dc:date>2020-05-21T12:31:35Z</dc:date>
  </entry>
  <entry>
    <title>RE: themeDisplay.getUserName() is not working in javascript</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119176565" />
    <author>
      <name>Olaf Kock</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119176565</id>
    <updated>2020-05-18T09:14:42Z</updated>
    <published>2020-05-18T09:14:42Z</published>
    <summary type="html">&lt;div class="quote-title"&gt;Varun Gupta:&lt;/div&gt;&lt;blockquote&gt;&lt;br /&gt;Hello All,themeDisplay.getUserName() is not working properly in javascript. It is giving ASCII string. Please refer screenshot.&lt;br /&gt;&lt;br /&gt;Is there any other way to get userName in javascript or I have to make service call to get userName?Thanks in advance.&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;It looks like the user you took the screenshot with is named &amp;#34;Test Test&amp;#34; - &amp;#34;\u0054\u0065\u0073\u0074\u0020\u0054\u0065\u0073\u0074&amp;#34; is the Unicode encoding of that string, so the result comes in an unexpected encoding, but it&amp;#39;s there. Which (exact) version are you on?</summary>
    <dc:creator>Olaf Kock</dc:creator>
    <dc:date>2020-05-18T09:14:42Z</dc:date>
  </entry>
  <entry>
    <title>themeDisplay.getUserName() is not working in javascript</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119172433" />
    <author>
      <name>Varun Gupta</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119172433</id>
    <updated>2020-05-18T07:50:31Z</updated>
    <published>2020-05-18T07:50:31Z</published>
    <summary type="html">Hello All,themeDisplay.getUserName() is not working properly in javascript. It is giving ASCII string. Please refer screenshot.&lt;br /&gt;&lt;img src="/documents/portlet_file_entry/14/image--tempRandomSuffix--5RSTzE2x.png/f122bb8b-9809-6e37-e214-09134ad251e7" /&gt;&lt;br /&gt;Is there any other way to get userName in javascript or I have to make service call to get userName?Thanks in advance.</summary>
    <dc:creator>Varun Gupta</dc:creator>
    <dc:date>2020-05-18T07:50:31Z</dc:date>
  </entry>
</feed>
