1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Securing blog comments

Securing blog comments

2 posts, 0 answered
  1. Marco Tana
    Marco Tana avatar
    1 posts
    Registered:
    18 Jan 2005
    13 Mar 2008
    Link to this post
    Is there a way to force a user to sign-in/register first before he/she can comment on a blog?  I tried to see if there's a setting but there isn't one. 
  2. Tihomir
    Tihomir avatar
    53 posts
    Registered:
    24 Sep 2012
    14 Mar 2008
    Link to this post
    Hello Marco Tana,

    I am sorry but we currently do not provide this functionality out-of-the-box but it can be achieved by adding just a little custom code. You will need to extend one class - Telerik.Cms.Engine.WebControls.CommentsList. Here are some guidelines on how to do that with Sitefinity 3.2:

    1. In your CommentsList extender you will just need to add an event handler and subscribe to the submit button command in the CreateChildControls overridden method:

    this.Container.SubmitButton.Command += new CommandEventHandler(MySubmitButton_Command); 

    2. In this event handler you can check whether the user is authenticated:

    if (!this.Request.IsAuthenticated) 
       // this line will make the base event handler do nothing and skip the registration of the comment 
       this.ParentID = Guid.Empty;   
        


    3. You will need to modify the Blogs ContentViewSingleItem.ascx public control template to use your CommentsList extender instead of the old CommentsList custom control.

    Let us know how it goes!

    Greetings,
    Tihomir
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
2 posts, 0 answered