News:

Wondering if this will always be free?  See why free is better.

Main Menu

Hiding boards on Board Index

Started by codenaught, August 15, 2005, 01:12:37 AM

Previous topic - Next topic

codenaught

If for whatever reason you would like to hide a particular board from being shown on the Board Index, meaning it can only be accessed by url or by the jump to drop-down you can do it by doing the following steps:

Open
Themes/Default/BoardIndex.template.php

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


Add below it
              if ($board['id'] == 1) {
echo '';
                 } else {



Replace the 1 mentioned there with the id of the board you want to hide.

Next find
echo '
</td>
</tr>';
   }
}


Add an additional } to the bottom of this code

To hide multiple boards you can add:

} elseif ($board['id'] == 2) {
                              echo '';


right after the               if ($board['id'] == 1) {
echo '';




Dev Consultant
Former SMF Doc Coordinator

tentronik

Pardon me but cant you do this with admin panel -> boards -> board modify - unchecking all groups?

codenaught

Quote from: tentronik on August 15, 2005, 01:15:25 AM
Pardon me but cant you do this with admin panel -> boards -> board modify - unchecking all groups?
Unchecking all the groups will disallow them to see the board altogether. This way a member can still access the board if they have the url or see it in the quick jump.
Dev Consultant
Former SMF Doc Coordinator

tentronik

Ok, but if i uncheck all accept the member group member can see and access.
Or do you mean they should access but not see it?

codenaught

Quote from: tentronik on August 15, 2005, 01:38:47 AM
Ok, but if i uncheck all accept the member group member can see and access.
Or do you mean they should access but not see it?

I mean that all this does is removes the display of the board from the Board Index. All membergroups that are given access to it can still view it by the url and quick jump and all that don't have access will still be unable to see it.
Dev Consultant
Former SMF Doc Coordinator

tentronik

Ok but you could also just create a new user group and give special user this group id too.

Beagen

Thank you so much! I needed just this :)

Webmaster, Land of Lag.

bugsmi0

This doesn't work on 1.1RC2 the code results in error

bebe

I tried for 1.1RC3 also won't work. Anybody can help?  :(

Elmacik

#9
Its the same for 1.1 RC2 and RC3
Open your BoardIndex.template.php file and find this:
foreach ($category['boards'] as $board)
{

Add below it:

$hide_boards = array(1, 2, 3, 4); // The board ids you want to hide.. You can add many..
if (in_array($board['id'], $hide_boards)) continue;


Now all those boards should be hidden from view. (Including the admins.)
Home of Elmacik

bebe

#10
syntax error

never mind, it works after i did as following:
$hide_boards = array(5); // The board ids you want to hide.. You can add many..
if(!in_array($board['id'], $hide_boards))
{


added another } before the echo:   
    echo '
</table>';
}
echo '
</div>';
}


Thanks for your help.

Elmacik

Sorry, I corrected that. Would you please retry?
Home of Elmacik

bebe

#12
Ooo... your edited code works too, but the 'id lack of 1 ';D

May i know what's the difference of !in_array and in_array? What is the meaning of that '!'?

Why with the continue;, we then can just ditched the { }?


Elmacik

#13
First, in_array checks if an array includes the string we ask. If includes, it returns TRUE.
Quotation ( ! ) reverts the functions. So, !in_array checks if an array includes the string we ask. If includes, it returns FALSE

And continue; means, "continue to the next one"
This way yes, we just ditched the brackets { } :)
So my code means:
If board id is one of the following: 1,2,3,4 (if in_array)
Then do nothing, continue to the other one (so its hidden.. :) )
Home of Elmacik

bebe

Thank you so much for your explanation! :D

vosje505


King Steph1


metallica48423

the code wont be the same in all themes...  But similar should be at the end of the loop that display the boards :)
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

Elmacik

Home of Elmacik

Pepsi Lex

@Elmacik

What code can I use so boards can be hidden from board index and only viewable by url jump to guests?



Advertisement: