Fórum

Display screen name instead of full name

Michelle Wang, modificado 7 Anos atrás.

Display screen name instead of full name

New Member Postagens: 10 Data de Entrada: 03/08/12 Postagens Recentes
Hi,

I would like to display screen name instead of full name on message board portlet on liferay 6.2. I have created a customized hook and changed start.jsp in user_display. I tried to use PortalUtil.GetUserName(message.GetUserId(), message.GetUserName(), USER_NAME_NICKNAME), but got exception of "USER_NAME_NICKNAME cannot be resolved to a variable". I just wonder how I can display screen name on liferay 6.2. Any help would be greatly appreciated.
thumbnail
Samuel Kong, modificado 7 Anos atrás.

RE: Display screen name instead of full name

Liferay Legend Postagens: 1902 Data de Entrada: 10/03/08 Postagens Recentes
Just use the variable, 'userName'. It's already available in start.jsp (defined in init.jsp).
Michelle Wang, modificado 7 Anos atrás.

RE: Display screen name instead of full name

New Member Postagens: 10 Data de Entrada: 03/08/12 Postagens Recentes
Thanks for the quick reply.
In portlet/message_boards/thread_columns.jspf,
<liferay-ui:search-container-column-text
href="<%= rowURL %>"
name="started-by"
value='<%= message.isAnonymous() ? LanguageUtil.get(pageContext, "anonymous") : HtmlUtil.escape(PortalUtil.getUserName(message.getUserId(), message.getUserName())) %>'
/>
value returns full name instead of screen name. I couldn't find a way to get screen name. 'userName' does not work.
thumbnail
Samuel Kong, modificado 7 Anos atrás.

RE: Display screen name instead of full name

Liferay Legend Postagens: 1902 Data de Entrada: 10/03/08 Postagens Recentes
Where do you want to make the change? Are you trying to make the change in in thread_columns.jspf or in liferay-ui:user-display? The piece of code you posted from thread_columns.jspf doesn't call the liferay-ui:user-display taglb.
Michelle Wang, modificado 7 Anos atrás.

RE: Display screen name instead of full name

New Member Postagens: 10 Data de Entrada: 03/08/12 Postagens Recentes
I am working on customizing message board portlet. I would like to display screen name instead of full name everywhere on message board. The change on start.jsp made screen name shown on thread details. However, I couldn't find a way to show screen name for threads list under each category, for example, "Start By" and "Last Post By".
thumbnail
Samuel Kong, modificado 7 Anos atrás.

RE: Display screen name instead of full name

Liferay Legend Postagens: 1902 Data de Entrada: 10/03/08 Postagens Recentes
So your first and second message are two different questions, correct?

In thread_columns.jspf, you have access to the userId. You can use the userId along with UserLocalServiceUtil to grab the user and the user's screen name.
Michelle Wang, modificado 7 Anos atrás.

RE: Display screen name instead of full name

New Member Postagens: 10 Data de Entrada: 03/08/12 Postagens Recentes
It works. Thank you very much!!!