MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

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

Viewed 15847 time(s), 4 post(s) 9/3/2013 3:34:18 PMby super
super

super

9/3/2013 3:34:18 PM
How to make comments posting available for registered users only ?
This content has not been rated yet. 
6018 Reputation 709 Total posts
khorvat

khorvat

9/4/2013 2:35:10 PM
Can you please let us know in which section you want to make comments "private" ?

Regards
This content has not been rated yet. 
15993 Reputation 2214 Total posts
super

super

9/5/2013 1:09:39 PM
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.
This content has not been rated yet. 
6018 Reputation 709 Total posts
dbogdan

dbogdan

9/5/2013 2:19:21 PM
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.
This content has not been rated yet. 
231 Reputation 38 Total posts