1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. This forum is for release discussion only. Discussions that do not relate specifically to the resource release should be discussed in another, more appropriate forum.
    Dismiss Notice
  3. This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

How to: Exclude posts from specific forums from the "What's new?" list.

Discussion in 'Template Modifications [Archive]' started by TimWF, Jun 30, 2011.

  1. TimWF

    TimWF Active Member

    What this template modification accomplishes is eliminating one or more forums from the New Threads listing for ALL users. Note that the way I have implemented this specifically below logged out users would see the posts as they are directed to the page that is the "All Recent Messages" link for logged in users.

    Update the 'thread_list_item' template to the following code block, but edit on line 3 and replace "Forum Title to Exclude 1" and "Forum Title to Exclude 2" the forum titles you want to exclude. So if you wanted to exclude the forum we are in now on XenForo you would use "Template Modifications" to replace one of these. It would be better to use forum ids there, though I haven't found a way to get that info easily so just went with the names as it works. (But if you ever change the titles of any excluded forums it will require you to change this code block to keep the messages filtered.)

    Also as represented below the part of code:
    Code:
    !{$showingNewThreads} OR
    
    on line 3 could be removed. That is in place so that the exclusion does not apply when users are clicking the "All Recent Messages" link.

    If you want to exclude more or fewer (two exclusions are in the example) you can do this by adding/removing a:
    Code:
    AND {$thread.forum.title} != 'Forum Title to Exclude 2'
    
    to the ones already in there with the desired forum title.

    Code:
    <xen:require css="discussion_list.css" />
    
    <xen:if is="!{$showingNewThreads} OR ( {$thread.forum.title} != 'Forum Title to Exclude 1' AND {$thread.forum.title} != 'Forum Title to Exclude 2' )">
    
    <xen:if is="{$thread.isDeleted}"><xen:include template="thread_list_item_deleted" /><xen:else />
    
    <li id="thread-{$thread.thread_id}" class="discussionListItem {$thread.discussion_state} {xen:if {$thread.sticky}, 'sticky'} {xen:if {$thread.isNew}, 'unread'}" data-author="{$thread.username}">
    
    <div class="listBlock posterAvatar">
    <span class="avatarContainer">
    <xen:avatar user="$thread" size="s" img="true" />
    <xen:if is="{$thread.user_post_count}"><xen:avatar user="$visitor" size="s" img="true" class="miniMe" title="{xen:phrase you_have_posted_x_messages_in_this_thread, 'count={xen:number $thread.user_post_count}'}" /></xen:if>
    </span>
    </div>
    
    <div class="listBlock main">
    
    <div class="titleText">
    <h3 class="title">
    <xen:if is="{$thread.canInlineMod}"><input type="checkbox" name="threads[]" value="{$thread.thread_id}" class="InlineModCheck" id="inlineModCheck-thread-{$thread.thread_id}" data-target="#thread-{$thread.thread_id}" title="{xen:phrase select_thread}: '{$thread.title}'" /></xen:if>
    <xen:if is="{$showSubscribeOptions}"><input type="checkbox" name="thread_ids[]" value="{$thread.thread_id}" /></xen:if>
    <!-- TODO: Thread prefix here -->
    <a href="{xen:link "threads{xen:if '{$thread.isNew} AND {$thread.haveReadData}', '/unread'}", $thread}"
    title="{xen:if '{$thread.isNew} AND {$thread.haveReadData}', {xen:phrase go_to_first_unread_message}}"
    class="{xen:if $thread.hasPreview, PreviewTooltip}"
    data-previewUrl="{xen:if $thread.hasPreview, {xen:link threads/preview, $thread}}">{xen:helper wrap, $thread.title, 50}</a>
    <xen:if is="{$thread.isNew}"><a href="{xen:link threads/unread, $thread}" class="unreadLink" title="{xen:phrase go_to_first_unread_message}"></a></xen:if>
    </h3>
    
    <xen:if hascontent="true">
    <div class="iconKey">
    <xen:contentcheck>
    <xen:if is="{$thread.isModerated}"><span class="moderated" title="{xen:phrase moderated}">{xen:phrase moderated}</span></xen:if>
    <xen:if is="!{$thread.discussion_open}"><span class="locked" title="{xen:phrase locked}">{xen:phrase locked}</span></xen:if>
    <xen:if is="{$thread.sticky}"><span class="sticky" title="{xen:phrase sticky}">{xen:phrase sticky}</span></xen:if>
    <xen:if is="{$thread.isRedirect}"><span class="redirect" title="{xen:phrase redirect}">{xen:phrase redirect}</span></xen:if>
    </xen:contentcheck>
    </div>
    </xen:if>
    
    <div class="secondRow">
    <div class="posterDate muted">
    <xen:username user="$thread" title="{xen:phrase thread_starter}" />,
    <a{xen:if {$visitor.user_id}, ' href="{xen:link threads, $thread}"'} class="faint"><xen:datetime time="$thread.post_date" title="{xen:if {$visitor.user_id}, '{xen:phrase go_to_first_message_in_thread}'}" /></a><xen:if is="{$showForumLink}">,
    <a href="{xen:link forums, $thread.forum}" class="forumLink">{$thread.forum.title}</a></xen:if>
    
    <xen:if is="{$showLastPageNumbers} AND {$thread.lastPageNumbers}">
    <span class="itemPageNav">
    <span>...</span>
    <xen:foreach loop="$thread.lastPageNumbers" value="$pageNumber">
    <a href="{xen:link threads, $thread, 'page={$pageNumber}'}">{$pageNumber}</a>
    </xen:foreach>
    </span>
    </xen:if>
    </div>
    
    <div class="controls faint">
    <xen:if is="{$thread.canEditThread}"><a href="{xen:link 'threads/list-item-edit', $thread}" class="EditControl">{xen:phrase edit}</a></xen:if>
    <xen:if is="{$showSubscribeOptions} AND {$thread.email_subscribe}">{xen:phrase email}</xen:if>
    </div>
    </div>
    </div>
    </div>
    
    <div class="listBlock stats pairsJustified" title="{xen:phrase members_who_liked_first_message}: {xen:if $thread.isRedirect, '&ndash;', {xen:number $thread.first_post_likes}}">
    <dl class="major"><dt>{xen:phrase replies}:</dt> <dd>{xen:if $thread.isRedirect, '&ndash;', {xen:number $thread.reply_count}}</dd></dl>
    <dl class="minor"><dt>{xen:phrase views}:</dt> <dd>{xen:if $thread.isRedirect, '&ndash;', {xen:number $thread.view_count}}</dd></dl>
    </div>
    
    <div class="listBlock lastPost">
    <xen:if is="{$thread.isRedirect}">
    <div class="lastPostInfo">{xen:phrase n_a}</div>
    <xen:else />
    <dl class="lastPostInfo">
    <dt><xen:username user="$thread.lastPostInfo" /></dt>
    <dd class="muted"><a{xen:if '{$visitor.user_id}', ' href="{xen:link posts, $thread.lastPostInfo}" title="{xen:phrase go_to_last_message}"'} class="dateTime"><xen:datetime time="$thread.lastPostInfo.post_date" /></a></dd>
    </dl>
    </xen:if>
    </div>
    
    </li>
    
    </xen:if>
    
    </xen:if>
    
     
    enivid, CFodder, Markos and 3 others like this.
  2. ddmmh

    ddmmh Well-Known Member

    This is so handy for me as I want to exclude some RSS feeds in certain forums.

    Id love to see this as an addon!
     
    Markos likes this.
  3. Mike Law

    Mike Law Active Member

    same here, we need to exclude rss feeds from real posts this way!
    I just did a quick scan but all you did is add line 3 and 4 right?

    But, it doesn't work....

    thanks
     
  4. TimWF

    TimWF Active Member

    The only lines I added were the 3,4 and then the lines for the close if statement at the end in this.

    Mike, if you can post the forum you are trying to use this on and the if statement you used for it I can see if I see a problem. I have only tested this in a single case, but works there so it is probably my bad tutorial that is getting in the way here. :D
     
  5. Brogan

    Brogan XenForo Moderator Staff Member

    I believe it's working now.
    He posted another thread asking for support, which has now been resolved.
     
  6. Mike Law

    Mike Law Active Member

    Indeed it is! Sorry I "freaked" out a little so posted all over the place!
    Basically your instructions worked fine, I just did not realize I had to put the "Forum Name As In The Actual Name" and put the forum # in,
    Brogan pointed this out and it "almost" works now!

    it is weird as it does show in "What's new" that there are 4 pages of new posts, but they don't show so that's good! On the tapatalk they still show, but I dont care much about that.

    Is there anyway we can make this into an actual add-on with options and bells and whistles?

    Anyways, thank you all!
     
  7. TimWF

    TimWF Active Member

    I don't have any plans to do an add-on that does this as this at this point. Yea, this doesn't effect anything with tapatalk, I think they pull thread information through an add-on of their own, so that add-on or templates associated with that add-on would have to be altered in some way in order to prevent posts from making it there.
     
  8. MikeMpls

    MikeMpls Well-Known Member

    This works well as far as it goes, but if the "What's new" list is empty, my supposedly hidden forum's posts still show up in "Recent Activity".
     
  9. Brogan

    Brogan XenForo Moderator Staff Member

    Posts will only show to those who have the relevant permissions.
     
  10. CFodder

    CFodder Well-Known Member

    Nice little modifications, works a treat so I won't have any of our members moaning about the RSS feeds clogging up their what's new :).
     
  11. MikeMpls

    MikeMpls Well-Known Member

    The forum is open to anyone who knows the URL but I don't want it shown in news feeds (Recent Activity) or listings of new posts.

    It doesn't do much good to hide a forum by unchecking "Display in the Node List" if its posts are shown conspicuously elsewhere.
     
  12. Brogan

    Brogan XenForo Moderator Staff Member

    Set it as a private node and then and allow access only to those who you want to see the content.
     
  13. MikeMpls

    MikeMpls Well-Known Member

    Won't work. Those who want to post will have to register, but most readers will be unregistered.

    I don't care if they participate in the board as a whole (they are more than welcome to do so), but I don't want others stumbling into the special forum.
     
  14. DRE

    DRE Well-Known Member

  15. Digital Doctor

    Digital Doctor Well-Known Member

    Note:


     
  16. DRE

    DRE Well-Known Member

    Ugh. It creates a long list of pages in what's new and if you exclude forums, it does not close the gap. You'll just end up pissing members off.

    Don't even bother with this modification.
     

Share This Page