PDA

View Full Version : Hide specific subforums on forumhome


Pieper
11-10-2013, 11:22 AM
Hello,

Can't seem to find the right conditionals for hiding specific subforums ( not all). I want to hide it only on the forumhome and not one click down.

I add '<vb:if condition="!in_array($forumid, array(X))">' ( where X is the forumID) at the top of the forumhome_forumbit_level2_post template en close the template with '</vb:if>'

When I use the forumID from 'Test' (see screenshot)it's hiding correct. I can add several forumID's( separating them with commas). They are all hiding correct.

The problem is when I use a forumID from Test1, Test2 etc they are not hiding.

I'm pretty much a noob when it comes to conditionals so I hope someone can help me with this.

It's on VB 4.2.1

Thanks!

ozzy47
11-10-2013, 12:18 PM
This is untested, but it should work in theory.

In the template forumhome_forumbit_level2_post look for this code:
<vb:if condition="$show['subforums']">
<div class="subforums">
<h4 class="subforumlistlabel">{vb:rawphrase subforums}:</h4>
<ol class="subforumlist commalist">
{vb:raw forum.subforums}
</ol>
</div>
</vb:if>And change it to this:
<vb:if condition="$show['subforums'] AND !in_array($forum['forumid'],array(1,2,3,))">
<div class="subforums">
<h4 class="subforumlistlabel">{vb:rawphrase subforums}:</h4>
<ol class="subforumlist commalist">
{vb:raw forum.subforums}
</ol>
</div>
</vb:if>

Change the ID's 1,2,3 to your forums.

Pieper
11-10-2013, 12:27 PM
Thank you Ozzy

The problem with the solution you posted is that the code below is not in the forumhome_forumbit_level2_post template.

<vb:if condition="$show['subforums']">
<div class="subforums">
<h4 class="subforumlistlabel">{vb:rawphrase subforums}:</h4>
<ol class="subforumlist commalist">
{vb:raw forum.subforums}
</ol>
</div>
</vb:if>

The only thing with the condition 'subforums' is:

</vb:if>

<vb:if condition="$show['subforums']">

{vb:raw forum.subforums}

ozzy47
11-10-2013, 12:49 PM
Strange, but none the less change this line:
<vb:if condition="$show['subforums']">To this:
<vb:if condition="$show['subforums'] AND !in_array($forum['forumid'],array(1,2,3,))">

Pieper
11-10-2013, 01:04 PM
Great!

When I change that code and use the Test forumID the subs are gone on the forumhome!

Thank you again Ozzy!

ozzy47
11-10-2013, 01:05 PM
Not a problem, glad to help. :)