Change or Hide Author

Topics: ASP.NET 2.0
Jan 20, 2011 at 5:38 PM

Our system uses email address as the username but I don't want to expose our author's email address on every blog post.

Is there a way to change this field to the Author's name or if not is there a way to hide the "by <author>" line?

Many thanks

---

Sid

Coordinator
Jan 21, 2011 at 8:17 AM

In the theme folder, which is located under /themes/<theme_name> there is a file named PostView.ascx.  In there, you can modify the markup so it outputs differently.  As an example, in the Standard theme, the relevant piece of markup looks like:

<span class="author">by <a href="<%=VirtualPathUtility.ToAbsolute("~/") + "author/" +
 BlogEngine.Core.Utils.RemoveIllegalCharacters(Post.Author) %>.aspx">
<%=Post.AuthorProfile != null ? Post.AuthorProfile.DisplayName : Post.Author %></a></span>

For example, you could hard code it to "Bob":

<span class="author">by <a href="<%=VirtualPathUtility.ToAbsolute("~/") + "author/" +
 BlogEngine.Core.Utils.RemoveIllegalCharacters(Post.Author) %>.aspx">Bob</a></span>

Or you could remove the line all together.  A 3rd option would be to modify the profile for the user in the control panel, and assign a Display Name to the user.  The original code above would then output the Display Name instead of the user's login name (email address).  So, you have a few options.

Feb 24, 2011 at 11:21 PM

Perfect! 
Exactly what I needed,

Many thanks for this Ben