Wednesday, October 10, 2007

Community Server Blog Post Approval Process

One thing glaringly absent in Community Server is the ability to have multiple blog authors with an approval process. The idea would be to have a blog writers who must submit their blog posts to a blog administrator for publishing. I've been looking into a solution for this and came up with one that should meet our needs for now.

My idea was to add a new role that would be able to save a blog post, but wouldn't have access to the publish button. To do this, I modified the CreateEditBlogPost.ascx file in \ControlPanel\Blogs\ to hide the publish button for everyone except a specific blog administrator role. Here's the code:

<CSControl:ConditionalContent runat="server">
<ContentConditions>
<CSControl:UserInRoleCondition Role="Solutions Blog Administrator" UseAccessingUser="true" runat="server" />
</ContentConditions>
<TrueContentTemplate></TrueContentTemplate>
<FalseContentTemplate><div style="display: none"></FalseContentTemplate>
</CSControl:ConditionalContent>
<strong><CP:resourcelinkbutton id="PostButton" runat="server" resourcename="CP_Blogs_CreateEditBlogPost_Post" CssClass="CommonTextButtonBig" /></strong></div>

This code would go at the bottom of the CreateEditBlogPost.ascx file where the publish button is now. As you can see, I just hid the publish button using a div with display:none in every case except when the user's role is "Solutions Blog Administrator". This allows me to specifically set who can publish to the blog while still allowing everyone else to write to the blog. Now I should be able to write a csmodule that will send an e-mail to the administrator(s) whenever a new blog is posted so they know they need to review the post and publish it.

Ideally there would be a permissions set into Community Server so I wouldn't have to hardcode the admin role. I'm also not sure how it will hold up once we have multiple blogs (and different administrators for each). But, this should work for now.

No comments: