More in this section

Forums / Bugs & Issues / "Show threads from all forums that are:" - bug, needs to be fixed

"Show threads from all forums that are:" - bug, needs to be fixed

2 posts, 0 answered
  1. Inna
    Inna avatar
    97 posts
    08 Jun 2012
    05 Dec 2012
    Link to this post
    Hello, the pwd protected forums - the 1st page of the project, before users login displays this:

    Show threads from all forums that are:
    Most Viewed

    See image attached. How do I get rid of it? thanks
  2. Pavel Benov
    Pavel Benov avatar
    341 posts
    14 Mar 2016
    10 Dec 2012
    Link to this post
    Hi Inna,

    I believe we have answered your question in Ticket 636613. I will paste the answer here for your reference:

    Hi Inna,

    Thank you for contacting us.

    In order to hide the thread links you will need to map a custom template for the ForumListView and use its code behind to hide the required items.

    First create an .ascx file in your project and then copy the forum list template's markup in it. (you can skip the first line from the template - e.g. <%@ Control Language="C#">). Here is the template markup for your convenience:

    <%@ Control Language="C#" %>
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    <%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI" Assembly="Telerik.Sitefinity" %>
    <%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.Fields" Assembly="Telerik.Sitefinity" %>
    <%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.ContentUI" Assembly="Telerik.Sitefinity" %>
    <%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Forums.Web.UI" Assembly="Telerik.Sitefinity.Forums" %>
    <%@ Register TagPrefix="sfForums" Namespace="Telerik.Sitefinity.Forums.Web.UI" Assembly="Telerik.Sitefinity.Forums" %>
    <%@ Import Namespace="Telerik.Sitefinity.Forums" %>
    <%@ Import Namespace="Telerik.Sitefinity.Forums.Model" %>
    <%@ Import Namespace="Telerik.Sitefinity.Localization" %>
    <h1 class="sfforumsTitle">
        <asp:Literal ID="Literal1" Text="<%$Resources: ForumsResources, ForumsTitle %>" runat="server" />
    <telerik:RadListView ID="list" ItemPlaceholderID="ItemsContainer" runat="server"
        EnableEmbeddedSkins="false" EnableEmbeddedBaseStylesheet="false">
            <table class="sfforumsList">
                    <asp:PlaceHolder ID="ItemsContainer" runat="server" />
                <sf:Conditional If='<%# Eval("DataItem") is ForumGroup %>' runat="server">
                        <th colspan="4" scope="colgroup" class="sfforumTitleWrp">
                            <h2 class="sfforumGroupTitle">
                                <%# Eval("Title") %>
                            <p class="sfforumGroupDescription">
                                <%# Eval("Description") %>
                        <td class="sfforumTitleWrp">
                            <sf:DetailsViewHyperLink runat="server" DataItem='<%# Eval("DataItem") %>' TextDataField="Title"
                                CssClass="sfforumTitle" />
                            <p class="sfforumDescription"><%# Eval("Description") %></p>
                        <td class="sfforumThreadsCountWrp">
                            <strong class="sfforumThreadsCount"><%# Eval("ThreadsCount") %></strong>
                            <asp:Literal ID="Literal2" Text="<%$Resources: ForumsResources, Threads %>" runat="server" />
                        <td class="sfforumPostsCountWrp">           
                            <strong class="sfforumPostsCount"><%# Eval("PostsCount") %></strong>
                            <asp:Literal ID="Literal3" Text="<%$Resources: ForumsResources, Posts %>" runat="server" />
                        <td class="sfforumLastPostWrp">
                            <sf:Conditional If='<%# Eval("LastPostNickname") != null %>' runat="server">
                                <a href="<%# Eval("LastPostUrl") %>">
                                    <%# string.Format(Res.Get<ForumsResources>().LastPostByUser, Eval("LastPostNickname"))%>
                                <div class="sfforumLastPostAge">
                                    <%# Eval("LastPostAge") %>
    <div class="sfforumsFilterWrp">
        <asp:Label runat="server" id="threadsFilterLabel" Text="<%$Resources:ForumsResources, ShowThreadsFromAllForums %>" CssClass="sfforumsFilterLbl" />
        <sfForums:ThreadsFilterControl id="threadsFilterControl" runat="server" class="sfthreadsFilterListWrp" />

    Then place the following code in the code behind file of the template:

    if (!HttpContext.Current.User.Identity.IsAuthenticated)
                   threadsFilterLabel.Visible = false;
                   threadsFilterControl.Visible = false;

    This code checks if the current user has been authenticated and if not hides the threads. 

    Build the solution and open your project in the browser. Click on the Edit button of the forum widget and then click on Advanced button. Go to ControlDefinitions->Views->ForumsFrontendList and in the TemplatePath field write the relative path to the template you have created.

    Save the changes and publish the page, then visit the page as an anonymous user - the links should not be rendered. I have recorded a short video for your convenience.

    I hope you find this helpful and please let me know if you have any further questions.

    Pavel Benov 
    the Telerik team

    Kind regards,
    Pavel Benov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered