Comment section for News

Vote:
 

Hi,

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?

Thanks
Pankaj

#118774
Mar 13, 2015 13:31
Vote:
 

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.

#118777
Mar 13, 2015 13:57
Vote:
 

Something like this:

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

    [Display(
        GroupName = SystemTabNames.Content,
        Order = 200)]
    [UIHint(UIHint.Textarea)]
    public virtual string Text { get; set; }

    [Display(
        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 (http://mydomain.com/some-article/comments/comment-1)
The page w/o page controller (container page) can be editable in EPi, but throws 404 when accessed directly in browser

#118781
Mar 13, 2015 14:04
Vote:
 

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.

#118782
Mar 13, 2015 14:06
Vote:
 

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 https://disqus.com/

#118785
Mar 13, 2015 14:14
Vote:
 

Thanks Dejan, I wil try to implement it.

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

#118786
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.