More in this section

Forums / Developing with Sitefinity / Blog comments for registered users

Blog comments for registered users

2 posts, 0 answered
  1. waynegs
    waynegs avatar
    2 posts
    Registered:
    05 Apr 2007
    11 May 2010
    Link to this post
    I am looking for a way to setup the blog comments so that only registered users can post and they do not have to enter their email and name once they have logged into the site.

    Thanks,

    Wayne
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    11 May 2010
    Link to this post
    Hi waynegs,

    Auto fill the name of the currently logged in user requres a custom control that inherits from CommentsList  . Sample code:

    namespace Telerik.Samples
    {
        public class CustomComments : CommentsList
        {
            public CustomComments()
            {
      
            }
      
            public override string LayoutTemplatePath
            {
                get
                {
                    // REMOVE THE VALIDATORS FROM THE TEMPLATE OF OUR CUSTOM CONTROL
                    return "~/Sitefinity/ControlTemplates/Blogs/CommentsList.ascx";
                }
            }
      
            protected override void CreateChildControls()
            {
                base.CreateChildControls();
                SubmitButton.Click += new EventHandler(SubmitButton_Click);
            }
      
            void SubmitButton_Click(object sender, EventArgs e)
            {
                if (String.IsNullOrEmpty(AuthorText.Text))
                {
                      
                    AuthorText.Text = UserManager.GetCurrentUserName();
                    // DO THE SAME FOR THE OTHER FILEDS
                      
                }
            }
      
             
        }
      
    }


    In the ListPageDetail template you need to remove the default BlogCommnets control and use the custom one.

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
2 posts, 0 answered