Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: MoreBloodWine on December 29, 2011, 10:32:36 PM

Title: Hide child board display on main forum index ?
Post by: MoreBloodWine on December 29, 2011, 10:32:36 PM
I made this (http://www.spiritualwarbiblestudies.com/index.php?action=forum) site for a friend of mine but he was curious about something.

Is there a way ti hide the sub / child board display ?
Title: Re: Hide childboard display on main forum index ?
Post by: Illori on December 30, 2011, 06:12:00 AM
not by default
Title: Re: Hide childboard display on main forum index ?
Post by: MoreBloodWine on December 30, 2011, 12:17:20 PM
Quote from: Illori on December 30, 2011, 06:12:00 AM
not by default
Is there any quick code to /**/ to hide it ?
Title: Re: Hide childboard display on main forum index ?
Post by: Illori on December 30, 2011, 12:19:06 PM
no idea off hand, it may be possible.
Title: Re: Hide childboard display on main forum index ?
Post by: Kays on December 30, 2011, 01:10:16 PM
This should work. In BoardIndex.template.php look for:


if (!empty($board['children']))
{


And add after that:


                                        break;
Title: Re: Hide childboard display on main forum index ?
Post by: Sir Osis of Liver on December 30, 2011, 01:21:44 PM

Or you can do this:



<!--td class="windowbg3 smalltext largepadding"><strong>', $txt['parent_boards'], '</strong>: ', implode(', ', $children), '</td-->



Title: Re: Hide childboard display on main forum index ?
Post by: MoreBloodWine on December 30, 2011, 05:46:07 PM
Quote from: Kays on December 30, 2011, 01:10:16 PM
This should work. In BoardIndex.template.php look for:


if (!empty($board['children']))
{


And add after that:

                                        break;

This works, but if there's a board below it with children it hides them, the other boards with child boards.

I tried the other suggestion but there's these little weird offsets with it that are hard to mis because of the TR but if you "hide" the TR then the whole display goes out of whack.
Title: Re: Hide childboard display on main forum index ?
Post by: Kays on December 30, 2011, 06:33:17 PM
Two other opitions. :)

BoardIndex.template.php

Look for


// Show the "Child Boards: ". (there's a link_children but we're going to bold the new ones...)


And add before that:


                                 $board['children'] = array();


Or in Subs-BoardIndex.php look for


// A valid child!
$isChild = true;


And add before that


                         continue;
Title: Re: Hide childboard display on main forum index ?
Post by: MoreBloodWine on December 30, 2011, 06:39:56 PM
Quote from: Kays on December 30, 2011, 06:33:17 PM
Two other opitions. :)

BoardIndex.template.php

Look for


// Show the "Child Boards: ". (there's a link_children but we're going to bold the new ones...)


And add before that:


                                 $board['children'] = array();


Or in Subs-BoardIndex.php look for


// A valid child!
$isChild = true;


And add before that


                         continue;

Ok, so scratch original idea then go for either or of the new ones but not both ?
Title: Re: Hide childboard display on main forum index ?
Post by: Kays on December 30, 2011, 06:46:16 PM
Whichever one works best for you. :)

The first is theme specific. The second prevents the child board array from being built. So it's not theme specific.
Title: Re: Hide childboard display on main forum index ?
Post by: MoreBloodWine on December 30, 2011, 06:48:58 PM
Quote from: Kays on December 30, 2011, 06:46:16 PM
Whichever one works best for you. :)

The first is theme specific. The second prevents the child board array from being built. So it's not theme specific.
Well, the second (continue;) one is what did the trick.

http://www.spiritualwarbiblestudies.com/index.php?action=forum

My buddy who I made the site for said he wanted to clean it up a bit and have the child boards hidden til the board is opened up and then the children get displayed.
Title: Re: Hide child board display on main forum index ?
Post by: Kays on December 30, 2011, 07:27:37 PM
Great, glad you got something to work. :)

A simple edit as that will be easy to remove afterwards.
Title: Re: Hide child board display on main forum index ?
Post by: MoreBloodWine on January 03, 2012, 05:50:52 PM
I didn't know this until now but while the continue; thing stops the child array from being built, it breaks the count child in parent totals thing and I kinda want / need that.

Any ideas how to correct this ?
Title: Re: Hide child board display on main forum index ?
Post by: Illori on January 03, 2012, 05:52:47 PM
you mean

admin -> boards -> settings Count child's posts in parent's totals 

is enabled?
Title: Re: Hide child board display on main forum index ?
Post by: MoreBloodWine on January 03, 2012, 05:55:56 PM
Quote from: Illori on January 03, 2012, 05:52:47 PM
you mean

admin -> boards -> settings Count child's posts in parent's totals 

is enabled?
Yes, because when I removed the continue; edit to show the child array the count in parent totals comes back as well along with showing the last post by thing etc.

Check out spiritualwarbiblestudies.com and open Second Thessalonians where you will see the one post i nthe child board but not have any of it's data show on the main board.
Title: Re: Hide child board display on main forum index ?
Post by: Kays on January 03, 2012, 06:06:36 PM
Yes, it will do that since the data for the child boards isn't being collected.

Use option A in that post then. I'm pretty certain that it will work.
Title: Re: Hide child board display on main forum index ?
Post by: MoreBloodWine on January 03, 2012, 06:19:26 PM
Quote from: Kays on January 03, 2012, 06:06:36 PM
Yes, it will do that since the data for the child boards isn't being collected.

Use option A in that post then. I'm pretty certain that it will work.
If you mean $board['children'] = array(); it doesnt, check out spiritualwarbiblestudies, I left it bugged...

Let me know after you look so I can correct the "bugging".

Edit: Option B's the only one that half worked.
Title: Re: Hide child board display on main forum index ?
Post by: Kays on January 03, 2012, 06:35:22 PM
Dang, it used to work for 1.1.x. ::)

Option C. A bit further up the page (~ line 135) look for:


foreach ($category['boards'] as $board)
{


and add after it:


$board['children'] = array();
Title: Re: Hide child board display on main forum index ?
Post by: MoreBloodWine on January 03, 2012, 06:41:08 PM
Quote from: Kays on January 03, 2012, 06:35:22 PM
Dang, it used to work for 1.1.x. ::)

Option C. A bit further up the page (~ line 135) look for:


foreach ($category['boards'] as $board)
{


and add after it:


$board['children'] = array();

So undo the goofy one or leave it to work in conjunction with this new one ?

Edit: OT but how if at all do you enabled line numbers in PuTTy, I'm using vi to do the edits.

Edit 2: Got it but still curious about the OT edit.
Title: Re: Hide child board display on main forum index ?
Post by: Kays on January 03, 2012, 06:48:03 PM
Remove the previous code added. You're just moving it up the page.

I don't use PuTTy, It might be an option in the View menu. If there is one.
Title: Re: Hide child board display on main forum index ?
Post by: MoreBloodWine on February 25, 2012, 03:03:44 AM
Quote from: Kays on January 03, 2012, 06:35:22 PM
Dang, it used to work for 1.1.x. ::)

Option C. A bit further up the page (~ line 135) look for:


foreach ($category['boards'] as $board)
{


and add after it:


$board['children'] = array();


How would I not have this applied to group 1 / Developer ?

I was thinking something like this but don't know what to use in the rest of it to make it work.

if($context['user']['WHAT TO USE HERE']){
            $board['children'] = array();
}

Basically I need to be able to see the sub boards to test certain things.

Ty.
Title: Re: Hide child board display on main forum index ?
Post by: Kays on February 25, 2012, 08:15:27 AM
Group 1 is admin  so you could use $context['user']['is_admin']

Another way is to download my custom permissions mod (link in my sig) and use that.

if (allowedTo(NewPermission))

Then you can enable or disable it in the Admin CP when you want.
Title: Re: Hide child board display on main forum index ?
Post by: MoreBloodWine on February 25, 2012, 11:28:56 AM
Quote from: Kays on February 25, 2012, 08:15:27 AM
Group 1 is admin  so you could use $context['user']['is_admin']

Another way is to download my custom permissions mod (link in my sig) and use that.

if (allowedTo(NewPermission))

Then you can enable or disable it in the Admin CP when you want.
Using use is admin would apply it only for me, thing thing is, I need to be able to have the subs seen by me but hidden to everyone else so it would have to be like an is not admin.
Title: Re: Hide child board display on main forum index ?
Post by: Kays on March 08, 2012, 11:26:15 AM
So with that, did you mange to accomplish what you wanted to do? ???