Foros de discusión

Display screen name instead of full name

Michelle Wang, modificado hace 7 años.

Display screen name instead of full name

New Member Mensajes: 10 Fecha de incorporación: 3/08/12 Mensajes recientes
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 hace 7 años.

RE: Display screen name instead of full name

Liferay Legend Mensajes: 1902 Fecha de incorporación: 10/03/08 Mensajes recientes
Just use the variable, 'userName'. It's already available in start.jsp (defined in init.jsp).
Michelle Wang, modificado hace 7 años.

RE: Display screen name instead of full name

New Member Mensajes: 10 Fecha de incorporación: 3/08/12 Mensajes recientes
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 hace 7 años.

RE: Display screen name instead of full name

Liferay Legend Mensajes: 1902 Fecha de incorporación: 10/03/08 Mensajes recientes
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 hace 7 años.

RE: Display screen name instead of full name

New Member Mensajes: 10 Fecha de incorporación: 3/08/12 Mensajes recientes
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 hace 7 años.

RE: Display screen name instead of full name

Liferay Legend Mensajes: 1902 Fecha de incorporación: 10/03/08 Mensajes recientes
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 hace 7 años.

RE: Display screen name instead of full name

New Member Mensajes: 10 Fecha de incorporación: 3/08/12 Mensajes recientes
It works. Thank you very much!!!