"Show threads from all forums that are:" - bug, ne

Posted by Community Admin on 04-Aug-2018 21:08

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

All Replies

Posted by Community Admin on 05-Dec-2012 00:00

Hello, the pwd protected forums - the 1st page of the project, before users login displays this:

Show threads from all forums that are:
Recently
Replied
Newest
Most Viewed
Featured


See image attached. How do I get rid of it? thanks

Posted by Community Admin on 10-Dec-2012 00:00

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" />
</h1>
<telerik:RadListView ID="list" ItemPlaceholderID="ItemsContainer" runat="server"
    EnableEmbeddedSkins="false" EnableEmbeddedBaseStylesheet="false">
    <layouttemplate>
        <table class="sfforumsList">
            <tbody>
                <asp:PlaceHolder ID="ItemsContainer" runat="server" />
            </tbody>
        </table>
    </layouttemplate>
    <itemtemplate>
        <tr>
            <sf:Conditional If='<%# Eval("DataItem") is ForumGroup %>' runat="server">
                <Then>
                    <th colspan="4" scope="colgroup" class="sfforumTitleWrp">
                        <h2 class="sfforumGroupTitle">
                            <%# Eval("Title") %>
                        </h2>
                        <p class="sfforumGroupDescription">
                            <%# Eval("Description") %>
                        </p>
                    </th>
                </Then>
                <Else>
                    <td class="sfforumTitleWrp">
                        <sf:DetailsViewHyperLink runat="server" DataItem='<%# Eval("DataItem") %>' TextDataField="Title"
                            CssClass="sfforumTitle" />
                        <p class="sfforumDescription"><%# Eval("Description") %></p>
                    </td>
                    <td class="sfforumThreadsCountWrp">
                        <strong class="sfforumThreadsCount"><%# Eval("ThreadsCount") %></strong>
                        <asp:Literal ID="Literal2" Text="<%$Resources: ForumsResources, Threads %>" runat="server" />
                    </td>          
                    <td class="sfforumPostsCountWrp">           
                        <strong class="sfforumPostsCount"><%# Eval("PostsCount") %></strong>
                        <asp:Literal ID="Literal3" Text="<%$Resources: ForumsResources, Posts %>" runat="server" />
                    </td>
                    <td class="sfforumLastPostWrp">
                        <sf:Conditional If='<%# Eval("LastPostNickname") != null %>' runat="server">
                        <Then>
                            <a href="<%# Eval("LastPostUrl") %>">
                                <%# string.Format(Res.Get<ForumsResources>().LastPostByUser, Eval("LastPostNickname"))%>
                            </a>
  
                            <div class="sfforumLastPostAge">
                                <%# Eval("LastPostAge") %>
                            </div>
                        </Then>
                        </sf:Conditional>
                    </td>
                </Else>
            </sf:Conditional>
        </tr>
    </itemtemplate>
</telerik:RadListView>
 
<div class="sfforumsFilterWrp">
    <asp:Label runat="server" id="threadsFilterLabel" Text="<%$Resources:ForumsResources, ShowThreadsFromAllForums %>" CssClass="sfforumsFilterLbl" />
    <sfForums:ThreadsFilterControl id="threadsFilterControl" runat="server" class="sfthreadsFilterListWrp" />
</div>

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.

Regards,
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

This thread is closed