Comment section for News



I am trying to build a comment section for a news module, I have below question regarding this:

Where the comments will be saved? I guess it should be saved in a new table called comments in the Database. How this is done? I also need to associate UserID with the comments.
The WebAdmin will be able to approve/reject the comment. He should see all the comments will approve / reject button. How to achieve this?


Mar 13, 2015 13:31

Easiest thing to do is to create a container page called Comments under your article page, and then save each comment as EPi page.

CommentPage can have properties: UserId, IsApproved, etc.

Mar 13, 2015 13:57

Something like this:

[ContentType(GUID = "21884d6e-c1cf-4124-bc03-a06aed328780")]
public class CommentPage : PageData
        GroupName = SystemTabNames.Content,
        Order = 100)]
    public virtual string UserId { get; set; }

        GroupName = SystemTabNames.Content,
        Order = 200)]
    public virtual string Text { get; set; }

        GroupName = SystemTabNames.Content,
        Order = 300)]
    public virtual bool IsApproved { get; set; }

That's all you need.

You don't have to create a page controller, because you probably don't want to have comments as stand-alone pages (
The page w/o page controller (container page) can be editable in EPi, but throws 404 when accessed directly in browser

Mar 13, 2015 14:04

How the admin will be notified when the new comment is added? Will he have to go through all the nodes and see which ones are newly added.

Mar 13, 2015 14:06

Something like this?

public class CommentService : ICommentService
    public void CreateComment(PageReference articlePage, string userId, string text)
        // TODO: check if comments are disabled on the page

        // TODO: check if Comments container exists

        // TODO: create a comment page

        // TODO: notify admins

Inside CreateComment method, you can get an external friendly URL of a comment page and email it to adminstrators.

If you don't want to create your own solution, you could try

Mar 13, 2015 14:14

Thanks Dejan, I wil try to implement it.

I sent you an email (on gmail), did you receive it?

Mar 13, 2015 14:19
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.