How to make the Name field readonly or hide it in Message Board?

Yang Wen asked on April 29, 2016 18:08

I'm dropped a Message Board web part on my page. Set the Name field to be visible so that posted messages will have a name associated with it. I'm prepopulating that field using the macro:
{# CMSContext.CurrentUser.UserName #}

What I can't figure out is how to set a readonly attribute on the name input box, or simply hide it all together? Surely this is a very basic functionality. Without doing either, the Name field is entirely editable and users can masquerade as another user when leaving a message. THanks.

Recent Answers


Yang Wen answered on April 29, 2016 18:34

I've resorted to using a very fragile CSS selector to hide the name field, since the Kentico generated markup does not contain a robust element ID.

0 votesVote for this answer Mark as a Correct answer

Jan Hermann answered on April 30, 2016 07:15

You can simply disable the text control in the \CMSModules\MessageBoards\Controls\Messages\MessageEdit.ascx file:

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

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.