comment box

Apr 11, 2015 at 6:45 PM
Edited Apr 11, 2015 at 6:46 PM
Hi, I was just wondering if only the comment box is shown for a logged in person, at Present it asks to enter name and e-mail also which I believe should directly be picked from session.

Please let me know if there is a solution available.
Aug 29, 2015 at 7:19 PM
I face the same problem Why would it ask for username name password for logged in user to make comment/reply?
Coordinator
Aug 29, 2015 at 8:54 PM
If you not logged in and trying to comment as existing user, it will ask you to log in to verify that you are this user. So someone else can't leave comments using your name. Unless I misunderstood the question, then clarify.
Aug 31, 2015 at 12:35 AM
I guess you did not understand the issue. Assume you are logged in your blog in the admin area. You are commenting on your blog in reply to someone's comment. Even if you are logged in you have to enter your name, email every time. That is why munendra was suggesting that it should put those info automatically from session.
Coordinator
Aug 31, 2015 at 2:28 AM
Yes I can see what you mean now. Assuming you using 3.1, you can modify your theme to do this.
In /custom/themes/yourtheme modify CommentForm.ascx adding server-side code:
<%
    var name = BlogEngine.Core.Security.CurrentUser.Identity.Name;
    var email = "";
    if (!string.IsNullOrEmpty(name))
    {
        email = Membership.Provider.GetUser(name, true).Email;
    }
%>
Then down in the HTML, use these variables as textbox values:
<input type="text" class="form-control" name="txtName" id="txtName" value="<%=name %>" />
<input type="text" class="form-control" id="txtEmail" value="<%=email %>" />
Sep 21, 2015 at 12:51 PM
Thanks for the information,
Incase you want to use the Display Name in the Name field you can add:

var fullname = "";
fullname = AuthorProfile.GetProfile(Security.CurrentUser.Identity.Name).DisplayName;

<input type="text" class="txt-user" name="txtName" id="txtName" value="<%=fullname %>" tabindex="2" />
Jan 23 at 5:34 PM
just share my code for this:
var fullname = "";
var name ="";
var email = "";
var website = "";
name= BlogEngine.Core.Security.CurrentUser.Identity.Name;
if (!string.IsNullOrEmpty(name))
{
    email = Membership.Provider.GetUser(name, true).Email;
    AuthorProfile currentAuthor = AuthorProfile.GetProfile(BlogEngine.Core.Security.CurrentUser.Identity.Name);
    if (currentAuthor != null)
    {
        fullname = currentAuthor.DisplayName;
        if (!string.IsNullOrEmpty(fullname))
        {
            // if user's display name is set, use display name
            name = fullname;
        }
        if (currentAuthor.CustomFields != null)
        {
            if (currentAuthor.CustomFields.ContainsKey("website"))
            {
                website = currentAuthor.CustomFields["website"].Value; 
            }
        }
    }
}
If user is logged in, comment form picks up user's display name(if empty, pick up user name instead) , email address and website address.