Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > How to show user name in message board View modes: 
User avatar
Member
Member
dinethnipuna-gmail - 2/12/2014 7:21:40 PM
   
How to show user name in message board
Hi,

I m using a message board for authenticated users. So what I want to do is capture their user name and display in the admin view of the message board. I m displaying only the message board text area for users, I don't want them to manually put their username , I want to capture it automatically and logged in the message board with the user comment.

At the moment ad an admin when I go to cmsdesk -> tools-> message boards and select the message board to see all the comments I have received it shows empty value under user name.
Can some one please help me.
Thanks.

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 2/12/2014 7:38:48 PM
   
RE:How to show user name in message board
Have you logged in as a non-admin or regular user? What are the results? You can use the macro below to get the current user name:
CMSContext.CurrentUser.UserName

User avatar
Member
Member
dinethnipuna-gmail - 2/12/2014 9:07:05 PM
   
RE:How to show user name in message board
Hi FroggEye,

I have logged as a regular user and added the comment on message board. After submit the message I have logged as an admin and go the cmsdesk->Tools->Messageboard-> then I select the particular message board to see the comment, when I try to see the comment for particular message board I can see comments and the date has submitted, but it doesn't show me who has submitted the message.
Thanks.

User avatar
Member
Member
kentico_davidb2 - 2/13/2014 1:58:49 AM
   
RE:How to show user name in message board
If you set the property of Message board's Show "Name" field to false, then the name is not being submitted.

If you do not want to enable users to change their name, but want to show their name at the same time, please enable this property and use the following customization:

In \CMSModules\MessageBoards\Controls\Messages\MessageEdit.ascx, around the line 30, there is a definition for the name textbox, please change it to:

<cms:CMSTextBox ID="txtUserName" runat="server" CssClass="TextBoxField" EnableViewState="false" MaxLength="250" ProcessMacroSecurity="false" Enabled="false"/>

It may be a good idea to clone both the webpart and associated controls, so that you still preserver the old behavior if you need it elsewhere.

User avatar
Member
Member
dinethnipuna-gmail - 2/13/2014 6:32:06 PM
   
RE:How to show user name in message board
Hi,
As you mentioned I have Enabled="false". But when I press Add button It give me a field validation on the Name text box and asked to enter the name.

Thanks.

User avatar
Member
Member
kentico_davidb2 - 2/27/2014 7:04:45 AM
   
RE:How to show user name in message board
This is expected, however, you mentioned that you are logged in as a user, in this case the name is being pre-populated. If you are having further issues in such scenario, you can also disable the field validation, however I don't think that that is what you want..