Mono Support How to make comments posting available for registered users only ? 

Viewed 17468 time(s), 4 post(s), 9/3/2013 3:34:18 PM - by super
9/3/2013 3:34:18 PM
6018 Reputation 709 Total posts

How to make comments posting available for registered users only ?

1
9/4/2013 2:35:10 PM
15993 Reputation 2214 Total posts

Can you please let us know in which section you want to make comments "private" ?

Regards

2
9/5/2013 1:09:39 PM
6018 Reputation 709 Total posts

I don't meant private comments - sorry if my question was confusing.

I meant..right now anyone can comment on the blog posts. But I want people to register first and then they should be able to post comment. I don't want comments posted by anonymous / guest users.

3
9/5/2013 2:19:21 PM
231 Reputation 38 Total posts

If you have control which inherits BlogComments control, you can override OnPreRender event.

In that event you can put additional check if current user is authenticated.

Try with this line of code:

pnlForm.Visible = (BlogPost != null && this.Page.User.Identity.IsAuthenticated) ? BlogPost.IsCommentEnabled : false;
It will still have comment list, but comment input form won't be visibile, if you are not logged in, i.e. registered.

4
This is a demo site for MonoX. Please visit Mono Software for more info.