Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: <?netwire> on August 31, 2008, 01:45:41 PM

Title: Ussing SSI and hideing boards?
Post by: <?netwire> on August 31, 2008, 01:45:41 PM
I did a quick search but did not find the answers to my question. I'm wanting to create a hidden board that only admin can see. I then want to add topics to that board and replies to topics. I want to then use SSI to show those topics (one topic, and it's replies).

For example;

I would have a board called "Homepage Articles" and the following topics

"Sample 1", "Sample 2", "Sample 3" (and so on)

Then on my homepage I would use SSI to include "Sample 1" and it's replies. Also, possibly an option to show only "Sample 1" and no replies (or show certain replies). Is this possible?
Title: Re: Ussing SSI and hideing boards?
Post by: DonGiovanni on August 31, 2008, 02:00:20 PM
maybe to look at all ssi functions?

http://www.simplemachines.org/community/ssi_examples.php
Title: Re: Ussing SSI and hideing boards?
Post by: [SiNaN] on August 31, 2008, 02:11:04 PM
Too long ago, I was trying to build an article system. So thought the same.

What I did was this; on the board index, I made my articles board as hidden for all members excluding admin. (You can do it by adding a few lines of code to your BoardIndex.template.php) But everybody had permission to view that boards, just I hid it from template.

Then I used ssi_boardNews() to get the information.

If you like the idea, I can provide you the codes.
Title: Re: Ussing SSI and hideing boards?
Post by: A2xA on August 31, 2008, 02:22:52 PM
I'm interested in this code if you'd like to share  :P
Title: Re: Ussing SSI and hideing boards?
Post by: [SiNaN] on August 31, 2008, 02:44:26 PM
It's just simple.

../Themes/your_theme/BoardIndex.template.php

Find:

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


Replace:

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

$article_boards = array(1,2,3,4,5);
$article_admins = array(1,2,3,4,5);

if(in_array($board['id'], $article_boards) && !in_array($context['user']['id'], $article_admins))
continue;


$article_boards are the ID of the boards to hide.
$article_admins are the ID of users that will see the boards.


If user ID is not avaible in $article_admins array, $article_boards will not be shown.