CS Nuggets

This blog is for addons, bugs, fixes, and issues pertaining to Community Server.

CS2007: Code Snipit: Listing Moderated users

Well, I wrote the following snipit to help out a friend and thought that I may as well post it here too.  This snipit uses a few of the features of Chameleon to create a table of all the users in your database.  Unmoderated users will be displayed with a red background as this is only an exercise in the use of the controls:

<table>
 <CSControl:UserList runat="server">
  <HeaderTemplate>
   <tr>
    <td>Display Name</td>
    <td>Moderation Level</td>
    <td>Posts Moderated</td>
   </tr>
  </HeaderTemplate>
  <ItemTemplate>
   <CSControl:ConditionalContent runat="server">
    <ContentConditions Operator="And" runat="server">
     <CSControl:UserPropertyValueComparison ComparisonProperty="ModerationLevel" ComparisonValue="Moderated" Operator="EqualTo" runat="server" />
    </ContentConditions>
    <TrueContentTemplate>
     <tr>
      <CSControl:UserData Property="DisplayName" Tag="td" runat="server" />
      <CSControl:UserData Property="ModerationLevel" Tag="td" runat="server" />
      <CSControl:UserData Property="PostsModerated" Tag="td" runat="server" />
     </tr>
    </TrueContentTemplate>
    <FalseContentTemplate>
     <tr style="background-color: Red;">
      <CSControl:UserData Property="DisplayName" Tag="td" runat="server" />
      <CSControl:UserData Property="ModerationLevel" Tag="td" runat="server" />
      <CSControl:UserData Property="PostsModerated" Tag="td" runat="server" />
     </tr>
    </FalseContentTemplate>
   </CSControl:ConditionalContent>
  </ItemTemplate>
  <RowSeparatorTemplate><br /></RowSeparatorTemplate>
 </CSControl:UserList>
</table>

Posted: Wed, Apr 25 2007 09:35 PM by Bill Bosacker | with no comments
Filed under: ,
Leave a Comment

(required) 

(required) 

(optional)

(required)