We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Locked Topic
[ C ] Hide only certain subforums?
Topic Started: Jan 6 2018, 12:40 PM (252 Views)
Ismailov
Member
[ *  * ]
Is it possible to hide one set of subforums while leaving others viewable?

For example, on my forum the Off-Topic section (viewable to registered users) has two subforums. What if I wanted to prevent them from showing on the front page, but also wanted to show subforums in other sections of the forum?
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
To clarify, you want them viewable when the main forum is accessed but hidden from the index page?
Offline Profile Goto Top
 
Ismailov
Member
[ *  * ]
Yes, but only certain ones.

For example, I want to hide all the subforums shown here: http://eregime.org/forum/124095/

It should still be possible to access them by clicking on "BoP Archives," "CountrySim Archives" or "Misc Archives," but they ideally shouldn't be viewable on the index page.

However, there are other forum areas on my site with subforums shown on the index page. I'd like for these to remain viewable.
Edited by Ismailov, Jan 8 2018, 07:18 PM.
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Admin CP Posted Image Themes Posted Image Board Template Posted Image Below the Board
Code:
 
<script type="text/javascript">
$('#forum-123949 + tr.c_info + tr, #forum-124000 + tr.c_info + tr, #forum-124003 + tr.c_info + tr').hide();
$('#forum-123949 td.c_mark, #forum-124000 td.c_mark, #forum-124003 td.c_mark').attr('rowspan', '2');
</script>
Offline Profile Goto Top
 
DaPizzaMan
Member Avatar
#TeamSupport

To improve on Cory's code, simply use the following:
Code:
 
<script type="text/javascript">
$(function() {
var hideForumID = [123949, 124000, 124003];
var i = 0;
var hiddenForums = hideForumID.length;
while (i < hiddenForums) {
$('#forum-' + hideForumID[i]).next().next('tr:has(td.c_subforum)').hide();
$('#forum-' + hideForumID[i] + ' td.c_mark').attr('rowspan', '2');
i++;
}
});
</script>
The only modification necessary is this:
Code:
 
var hideForumID = [123949, 124000, 124003];
Just add any forum ID into that list to hide its subforums.
Edited by DaPizzaMan, Jan 17 2018, 07:48 PM.
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
You should wrap a function around that code because i is an often used variable and you don't want this code conflicting with others.
Offline Profile Goto Top
 
DaPizzaMan
Member Avatar
#TeamSupport

Cory
Jan 13 2018, 12:46 AM
You should wrap a function around that code because i is an often used variable and you don't want this code conflicting with others.
Good point, I edited my post.
Offline Profile Goto Top
 
DaPizzaMan
Member Avatar
#TeamSupport

Completed!

Your request has been completed. If you have any questions or concerns regarding the state of your request, please feel free to contact me via PM.
Offline Profile Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Closed Requests · Next Topic »
Locked Topic