how to add "About Author" option in the blog post page ?

Topics: ASP.NET 2.0, Business Logic Layer, Controls
Jul 16, 2012 at 6:50 PM
Edited Jul 16, 2012 at 7:00 PM

how to add "About Author" option in the blog post page ?

Right now, it only shows the author title name on the blog post something like

"Blog Post" By administrator

How to add an option "About Author" by which author profile pic and description is visible on the blog post page ?

 

I have seen this tip (http://blogengine.codeplex.com/wikipage?title=FAQ#HowToUpdateAboutTheAuthorSection) but it is a manual process, when a website is having 100 blog posts daily and number of Editors are posting blog post, this is not a feasible way of adding link for one page every time.

Please help

Jul 16, 2012 at 8:08 PM

anyone please help ?

Coordinator
Jul 16, 2012 at 8:59 PM

PostView.ascx in the theme's folder is repeated for every blog post, so you can modify author info there.

Add this line right after control declaration (control language=...):

<% var profile = BlogEngine.Core.AuthorProfile.ToJson(Post.Author); %>
Now you have author's profile, use it any way you want. For example:

<span class="author">
  <img width="24" src="<%= profile.PhotoUrl %>" />
  <%= profile.AboutMe %>
</span>
If some authors don't have profile set up, you might need to add a check and load default picture and "about" text. But if profile filled in, this will work fine.

Jul 17, 2012 at 8:34 PM

Getting error message:

Error 1 'BlogEngine.Core.AuthorProfile' does not contain a definition for 'ToJson' C:\Users\Desktop\\BlogEngine.NET\themes\Standard\PostView.ascx 2 48 C:\...\BlogEngine.NET\

 

Here is my code:

<%@ Control Language="C#" AutoEventWireup="true" EnableViewState="false" Inherits="BlogEngine.Core.Web.Controls.PostViewBase" %>
<% var profile = BlogEngine.Core.AuthorProfile.ToJson(Post.Author); %>
<div class="post xfolkentry" id="post<%=Index %>">
  <h1><a href="<%=Post.RelativeLink %>" class="taggedlink"><%=Server.HtmlEncode(Post.Title) %></a></h1>
  <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>
  
  <span class="author">
  <img width="24" src="<%= profile.PhotoUrl %>" />
  <%= profile.AboutMe %>
</span>
  
  <span class="pubDate"><%=Post.DateCreated.ToString("d. MMMM yyyy HH:mm") %></span>
  
  <div class="text"><asp:PlaceHolder ID="BodyContent" runat="server" /></div>
  <div class="bottom">
    <%=Rating %>
    <p class="tags">Tags: <%=TagLinks(", ") %></p>
    <p class="categories"><%=CategoryLinks(" | ") %></p>
  </div>


  <div class="footer">    
    <div class="bookmarks">
      <a rel="nofollow" title="Index <%=Index %>" target="_blank" href="http://www.dotnetkicks.com/submit?url=<%=Server.UrlEncode(Post.AbsoluteLink.ToString()) %>&amp;title=<%=Server.UrlEncode(Post.Title) %>">Submit to DotNetKicks...</a>
    </div>
    
    <%=AdminLinks %>
    
    <% if (BlogEngine.Core.BlogSettings.Instance.ModerationType == BlogEngine.Core.BlogSettings.Moderation.Disqus)
       { %>
    <a rel="nofollow" href="<%=Post.PermaLink %>#disqus_thread"><%=Resources.labels.comments %></a>
    <%}
       else
       { %>
    <a rel="bookmark" href="<%=Post.PermaLink %>" title="<%=Server.HtmlEncode(Post.Title) %>">Permalink</a> |
    <a rel="nofollow" href="<%=Post.RelativeLink %>#comment"><%=Resources.labels.comments %> (<%=Post.ApprovedComments.Count %>)</a>   
    <%} %>
    </div>

</div>

Sep 5, 2012 at 1:39 AM

anyone ? please help

Coordinator
Sep 5, 2012 at 2:45 AM

You probably using some older version?

Sep 5, 2012 at 10:23 AM

I am using BlogEngine.NET 2.6 (web)

Mar 12, 2013 at 7:14 AM
Edited Mar 12, 2013 at 7:17 AM
I found a simple way of using profile pictures in my blog...(blogengine 2.7)

go to

Admin\users\profile.aspx.cs


search for the following code

string dir = Server.MapPath(Path.Combine("~/App_Data/files/Avatars/", login));

change your images directory by creating a new folder in the root folder. Ex: UserImages

comment the previous code and add the below code

string dir = Server.MapPath(Path.Combine("~/UserImages/files/Avatars/", login));

now your uploaded profile pictures will be stored in this folder

similary find the below line and replace with your folder location

fname = Path.Combine(string.Format("~/UserImages/files/Avatars/{0}/", login), fname);


you are now ready to go....

Goto your themes folder(ex:standard)

and go to postview.ascx

and add the below line to display the profile picture of author along with the post.
<img width="100" src="/UserImages/files/Avatars/<%=Post.AuthorProfile.PhotoUrl %>" alt="img" id="Img1" /> Test by creating a user --> upload a profile picture for the user --> and create a new post.

Thanks.
Mar 25, 2013 at 7:47 PM
I think it is a better idea to use Google Authorship for your profile. It should help SEO.