Change default Publish behavior on Add entry

Topics: Business Logic Layer, Themes
Jan 14, 2008 at 5:53 PM
When you log in to your blogengine site and click “Ad entry” tab in your backend (Control Panel) you see, by default, “Publish” option available and set to true.
In my site (intranet at my job) I need a way to allow only administrators to set publish option to true or some other user role that I decide. I solved the problem by opening “/admin/pages/Add_entry.aspx” and modifying line number 119 which contains following code

code <asp:CheckBox runat="server" ID="cbPublish" Text="<%$ Resources:labels, publish %>" Checked="true" TabIndex="15" /> code

Into something like this

code <% if (Page.User.IsInRole("Administrators"))
{ %>

<asp:CheckBox runat="server" ID="cbPublish" Text="<%$ Resources:labels, publish %>" Checked="false" TabIndex="15" />


<%}
else
{ %>
<asp:CheckBox runat="server" ID="CheckBox1" Text="<%$ Resources:labels, publish %>" Enabled="false" Checked="false" TabIndex="15" />
<% } %> code

What that did is to set only “Administrator” role to publish a web page, all other roles have option “Publish” disabled.
Just in case someone finds this useful.