CS Nuglet: Flexible Editor Type Selection by function

Community Server supports three versions of the site editor. The editor is used throughout the site for functions that vary from managing a user’s Bio to entering Forum and Blog posts. The three editor versions are Plain Text (no HTML), Standard (HTML), and Enhanced (more HTML widgets.) The editor used on the site is defined in the communityserver.config file <Editor /> area where the three are listed with one designated as default.  Each user can also set their editor of choice in their User Profile.

This works great, but what if you want to restrict users to a Plain Text editor for all functions except for, say, forum posts.  With a bit of Editor Control duping and tweaking this is easily achieved, along with some simple edit profile masking.

Before we do anything we’ll set the “Plain Text” editor as the default in the communityserver.config.  (If your site is already online you’ll need to manually or programmatically update existing user editor settings, since users are assigned the editor set as default at time of account creation.)  Now we want to prevent users from changing their editor type, but there’s a twist.  We want site administrators to use any darn editor they want.

To achieve this we place the Editor selection dropdown in a conditional placeholder.


<CSControl:PlaceHolder ID=”PlaceHolder0120a” runat=”server”>
            ID=”UserInRoleCondition1″ runat=”server”
            UseAccessingUser=”true” Role=”SystemAdministrator” />

        <td class=”CommonFormFieldName”>
            <CSControl:ResourceControl ID=”ResourceControl1″
                runat=”server” ResourceName=”EditProfile_Editor” />
        <td class=”CommonFormField”>
            <asp:DropDownList id=”EditorList” runat=”server” />


Next we copy the CS.Control.Editor class to our Drive custom library project and change a couple lines of code.  We would normally load the Editor based on the user’s SelectableEditor type, and the user’s editor type as you know is Plain Text.  So we load the Editor based on another user’s type instead, the “admin” who uses the Standard editor.

Whenever we want to provide our users with a Standard or Enhanced editor, we use our custom Drive Editor control.

<div class=”CommonFormField”>
    <DRIVE:Editor Width=”100%” runat=”Server” id=”PostBody” />

Poof!  HTML editor support enabled, wherever we want it.

Article written by

A long time developer, I was an early adopter of Linux in the mid-90's for a few years until I entered corporate environments and worked with Microsoft technologies like ASP, then .NET. In 2008 I released Sueetie, an Online Community Platform built in .NET. In late 2012 I returned to my Linux roots and locked in on Java development. Much of my work is available on GitHub.