This project is read-only.

Can Fields.MediaPicker show itself only to authenticated users

Topics: Customizing Orchard
Oct 12, 2012 at 3:37 PM

I have a custom type(Paper) with a Media Picker Field. I would like to show this link only to members. For this purpose, I created a view for this field "Fields.MediaPicker-Paper.cshml" in my custom theme. 

    string name = Model.ContentField.DisplayName;  
<p class="media-picker-field media-picker-field-@name.HtmlClassify()">
    @if(xxxxxxx) {
        <span class="name">@name:</span>
        <a href="@Href(Model.ContentField.Url)"><span class="value">@Model.ContentField.Url</span></a>
I would like to check the authentication of the user at the if(xxxxxx) but so far I couldn't find how to do such a simple thing!!! Am I heading to wrong direction? How do we accomblish this? 

Oct 12, 2012 at 4:27 PM

Answering my own question :)

if (WorkContext.CurrentUser != null)