This topic describes how to require registration for adding comments to blogs.
The necessary settings include extending the Telerik.Cms.Engine.WebControls.CommentsList class. Here are some guidelines on how to do that:
-
In the class that will extend the CommentsList class, add an event handler and subscribe to the SubmitButton command in the
CreateChildControls overridden method:
| CreateChildControls |
Copy Code |
|
this.Container.SubmitButton.Command += new CommandEventHandler(MySubmitButton_Command);
|
-
In this event handler, check whether the user is authenticated:
| Event Handler |
Copy Code |
|
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;
}
|
- Modify the Blogs ContentViewSingleItem.ascx public control template to use the custom class that extends CommentsList instead
of the old CommentsList custom control.