Advertisement:

Author Topic: Hiding boards on Board Index  (Read 44968 times)

Offline codenaught

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 14,653
  • Gender: Male
  • Formerly Known As akabugeyes
Hiding boards on Board Index
« on: August 15, 2005, 01:12:37 AM »
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
Code: [Select]
foreach ($category['boards'] as $board)
{

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


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

Next find
Code: [Select]
echo '
</td>
</tr>';
   }
}

Add an additional
Code: [Select]
} to the bottom of this code

To hide multiple boards you can add:

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

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



Dev Consultant
Former SMF Doc Coordinator

Offline tentronik

  • Full Member
  • ***
  • Posts: 499
  • logic is
    • [Roboter]
Re: Hiding boards on Board Index
« Reply #1 on: August 15, 2005, 01:15:25 AM »
Pardon me but cant you do this with admin panel -> boards -> board modify - unchecking all groups?

Offline codenaught

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 14,653
  • Gender: Male
  • Formerly Known As akabugeyes
Re: Hiding boards on Board Index
« Reply #2 on: August 15, 2005, 01:30:18 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

Offline tentronik

  • Full Member
  • ***
  • Posts: 499
  • logic is
    • [Roboter]
Re: Hiding boards on Board Index
« Reply #3 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?

Offline codenaught

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 14,653
  • Gender: Male
  • Formerly Known As akabugeyes
Re: Hiding boards on Board Index
« Reply #4 on: August 15, 2005, 02:49:47 PM »
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

Offline tentronik

  • Full Member
  • ***
  • Posts: 499
  • logic is
    • [Roboter]
Re: Hiding boards on Board Index
« Reply #5 on: August 15, 2005, 03:36:14 PM »
Ok but you could also just create a new user group and give special user this group id too.

Offline Beagen

  • Semi-Newbie
  • *
  • Posts: 27
  • Gender: Male
    • Land of Lag
Re: Hiding boards on Board Index
« Reply #6 on: August 19, 2005, 02:32:45 PM »
Thank you so much! I needed just this :)

Webmaster, Land of Lag.

Offline bugsmi0

  • Jr. Member
  • **
  • Posts: 196
Re: Hiding boards on Board Index
« Reply #7 on: February 26, 2006, 05:05:37 PM »
This doesn't work on 1.1RC2 the code results in error

Offline bebe

  • Semi-Newbie
  • *
  • Posts: 70
Re: Hiding boards on Board Index
« Reply #8 on: November 24, 2006, 09:08:12 PM »
I tried for 1.1RC3 also won't work. Anybody can help?  :(

Offline Elmacik

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,276
  • Gender: Male
  • = Human Draft =
    • IT Store
Re: Hiding boards on Board Index
« Reply #9 on: November 24, 2006, 09:15:52 PM »
Its the same for 1.1 RC2 and RC3
Open your BoardIndex.template.php file and find this:
Code: [Select]
foreach ($category['boards'] as $board)
{
Add below it:
Code: [Select]
$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.)
« Last Edit: June 10, 2007, 08:21:29 PM by Elmacik »
Home of Elmacik

Offline bebe

  • Semi-Newbie
  • *
  • Posts: 70
Re: Hiding boards on Board Index
« Reply #10 on: November 24, 2006, 09:31:07 PM »
syntax error

never mind, it works after i did as following:
Code: [Select]
$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:   
   
Code: [Select]
echo '
</table>';
}
echo '
</div>';
}

Thanks for your help.
« Last Edit: November 24, 2006, 09:53:05 PM by bebe »

Offline Elmacik

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,276
  • Gender: Male
  • = Human Draft =
    • IT Store
Re: Hiding boards on Board Index
« Reply #11 on: November 24, 2006, 09:52:47 PM »
Sorry, I corrected that. Would you please retry?
Home of Elmacik

Offline bebe

  • Semi-Newbie
  • *
  • Posts: 70
Re: Hiding boards on Board Index
« Reply #12 on: November 24, 2006, 10:00:24 PM »
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 { }?

« Last Edit: November 24, 2006, 10:07:52 PM by bebe »

Offline Elmacik

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,276
  • Gender: Male
  • = Human Draft =
    • IT Store
Re: Hiding boards on Board Index
« Reply #13 on: November 24, 2006, 10:08:00 PM »
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.. :) )
« Last Edit: November 25, 2006, 01:35:53 AM by Elmacik »
Home of Elmacik

Offline bebe

  • Semi-Newbie
  • *
  • Posts: 70
Re: Hiding boards on Board Index
« Reply #14 on: November 24, 2006, 11:10:17 PM »
Thank you so much for your explanation! :D

Offline vosje505

  • Semi-Newbie
  • *
  • Posts: 40
  • Gender: Male
    • ssva
Re: Hiding boards on Board Index
« Reply #15 on: May 30, 2007, 03:22:56 PM »
this is perfect :D thx ;D

Offline King Steph1

  • Semi-Newbie
  • *
  • Posts: 73
Re: Hiding boards on Board Index
« Reply #16 on: October 23, 2007, 06:38:03 PM »
Next find
Code: [Select]
echo '
</td>
</tr>';
   }
}


I can't find that.. SMF 1.1.4

Offline metallica48423

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,842
  • Gender: Male
  • Professional Multislacker!
    • Zentendo
Re: Hiding boards on Board Index
« Reply #17 on: November 14, 2007, 11:17:22 PM »
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

Quote
Microsoft 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
     

Offline Elmacik

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,276
  • Gender: Male
  • = Human Draft =
    • IT Store
Re: Hiding boards on Board Index
« Reply #18 on: November 18, 2007, 07:59:40 AM »
I can't find that.. SMF 1.1.4

Use my code, its neater and easier to do.
Home of Elmacik

Offline Pepsi Lex

  • Semi-Newbie
  • *
  • Posts: 16
Re: Hiding boards on Board Index
« Reply #19 on: November 04, 2008, 11:01:52 PM »
@Elmacik

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