Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Aiheen aloitti: darknovember - tammikuu 19, 2014, 08:45:52 IP

Otsikko: hidden forums feature?
Kirjoitti: darknovember - tammikuu 19, 2014, 08:45:52 IP
unsure if this is where I need to be posting this or not but,
I was wondering if there was a mod somewhere to where parts of the forum could be viewable by anyone logged in or not via clicking a link and NOT be listed on the index page
to be more specific a hidden category
Otsikko: Re: hidden forums feature?
Kirjoitti: margarett - tammikuu 20, 2014, 04:40:10 AP
That can be done with a little tweak in BoardIndex.template.php, by skipping the relevant "foreach" loop if the category id equals a proper number. I'm not on the computer now, if no one picks it up I will tell you later how to do it ;)
Otsikko: Re: hidden forums feature?
Kirjoitti: margarett - tammikuu 20, 2014, 06:15:34 IP
OK, taking the following setup as example:
(https://www.simplemachines.org/community/index.php?action=dlattach;topic=517165.0;attach=228094;image)

I have a category I want to hide from BoardIndex. This category has ID 2
Inside I have boards with ID 3 and 4.

Now, I go to BoardIndex.template.php and find:

// If theres no parent boards we can see, avoid showing an empty category (unless its collapsed)
if (empty($category['boards']) && !$category['is_collapsed'])
continue;

Replace with:

// If theres no parent boards we can see, avoid showing an empty category (unless its collapsed)
if ((empty($category['boards']) && !$category['is_collapsed']) || $category['id'] == 2)
continue;

(note the "== 2"? That's the relevant category ID)
So it is gone now:
(https://www.simplemachines.org/community/index.php?action=dlattach;topic=517165.0;attach=228096;image)

But I can still access the boards directly via www.forum_address.com/index.php?board=3.0 or www.forum_address.com/index.php?board=4.0 (3 and 4 are the board IDs that became hidden).
This way you will keep all the permissions you can set for a board. Also, the contents will still show in recent posts, unread messages, etc.
Otsikko: Re: hidden forums feature?
Kirjoitti: darknovember - tammikuu 21, 2014, 01:22:08 AP
wonder if im editing this properly x.x here is the path to the boardindex.template.php that i edited
/public_html/testforum/Themes/default
its in the themes directory, for the default theme.
thats the only place i know that that file is at haha, anyhow, when i make the change it just crashes the forum
"testforum/index.php?action=collapse;c=2;sa=collapse;f833db2=6fd03db8f1cd73cb2501be5845358ea7#c2"
is the actual link to the catagory that im trying to "hide" , its the second catagory there.
im running on smf  version  2.0.2  with the default core theme .

only other place i can figure that it could be changed at is
/public_html/testforum/Sources
on the boardindex.php file, but i have not tried editing it there as of yet....
Otsikko: Re: hidden forums feature?
Kirjoitti: margarett - tammikuu 21, 2014, 02:53:08 AP
Please attach your file here, with the changes that crash your forum
Otsikko: Re: hidden forums feature?
Kirjoitti: darknovember - tammikuu 21, 2014, 11:06:30 AP
ok, here ya go :)
Otsikko: Re: hidden forums feature?
Kirjoitti: darknovember - tammikuu 23, 2014, 11:59:05 IP
ill probably get in trouble for doing this but,
bump~
Otsikko: Re: hidden forums feature?
Kirjoitti: margarett - tammikuu 24, 2014, 05:24:22 AP
I'm sorry, I missed this.

The file you attached doesn't have the changes I proposed you to do.
Otsikko: Re: hidden forums feature?
Kirjoitti: emanuele - tammikuu 24, 2014, 05:50:18 AP
Create a board (accessible only to admins) and put all the other boards as child of that one.

ETA: the only drawback is that the linktree will show the "admin-only" board, and if someone would click on it he gets an error.
Otsikko: Re: hidden forums feature?
Kirjoitti: darknovember - tammikuu 24, 2014, 04:17:15 IP
at times i feel like such a noob haha on the topic id i needed 2.0 not 2 , haha got it now
thanks so much margarett

Thanks to you too emanuele , haha its a good idea , would of used it if i couldent get this figured out