UBB.Dev
Posted By: LK [6.7] [beta] Hide Private Forums - 07/11/2005 2:18 AM
Modification Name: Hide Private Forums

Author(s): LK

Description: Hides the private forums (from forum summary), only if you have access to those forums you can see them.

All-new code (nothing in common with the previous 6.5 version, besides the concept), now supports ultimatebb.php. Almost untested though.

Demo: none

Requirements: UBB 6.7, may work with others with little changes.

Download Link: https://www.ubbdev.com/ubb/upload/00004463/hide67.txt

Credits: Originally by wwb95

Note: it doesn't support password-enabled forums.
Posted By: AllenAyres Re: [6.7] [beta] Hide Private Forums - 07/11/2005 6:52 AM
thank you! I can finally use a private forum on my personal site now rockon rockon
Posted By: LK Re: [6.7] [beta] Hide Private Forums - 07/11/2005 2:21 PM
Updated ultimatebb.php (global $profile, chop), ubb_lib (make it repetitive in case you have more than 1 private forum)
Posted By: nprime Re: [6.7] [beta] Hide Private Forums - 07/13/2005 2:09 AM
LK,
Thanks for doing this. I am unable to find the following code in ubb_forum_summary.cg:.

Code
$msg_icon2    = qq!<img src="$vars_config{NonCGIURL}/icons/icon1.gif" align="middle" border="0" alt="$vars_wordlets_img{alt_icon} 1" /> !;
} else {
The closest I can find is the following
Code
$msg_icon2    = qq!<img src="$vars_config{NonCGIURL}/icons/icon1.gif" align="middle" border="0" alt="$vars_wordlets_img{alt_icon} 1" /> !;
}
I went back to my unmodded 6.7.2 file and still can't find it in there. Any ideas?
Posted By: LK Re: [6.7] [beta] Hide Private Forums - 07/13/2005 2:27 AM
Oops, you're right.
It should be:
Code
Find:
=====

$msg_icon = '';
$msg_icon2 = qq!<img src="$vars_config{NonCGIURL}/icons/icon1.gif" align="middle" border="0" alt="$vars_wordlets_img{alt_icon} 1" /> !;

Add below:
==========

$priv1="<?php echo Privates($x,"";
$priv2=""); ?>";
} else {
$priv1 = ''; $priv2 = '';
(updating txt file as we speak)

Note that msg_icon and msg_icon2 should be indeed one after the other, since about 10 lines above there is another instance of $msg_icon = '' and $msg_icon2 = ..., but they have another variable ($last_post_number) between them.
Posted By: Tiger66 Re: [6.7] [beta] Hide Private Forums - 07/17/2005 5:50 AM
Kewl hack, it looks like my board even loads faster now
Thanks thumbsup
Posted By: Tiger66 Re: [6.7] [beta] Hide Private Forums - 07/21/2005 12:55 AM
Would it be possible to hide the wings as well? it looks weird for the members to see a wing with no rooms

And I just noticed that the rooms you set to be hidden still shows under the Hop To menu (even if you are logged out)
Posted By: LK Re: [6.7] [beta] Hide Private Forums - 07/22/2005 6:12 PM
By wings, you mean categories? If so you can just put the private forums in another category.

Hop To: I'll fix it if there is a need.

The point of this hack is not that they won't know you have private forums, but that they won't be disturbed by that forum every time they go to Forum Summary. I don't know of anyone who actually uses the Hop To menu, so it doesn't really matter.
Posted By: AllenAyres Re: [6.7] [beta] Hide Private Forums - 07/22/2005 9:42 PM
one guy on the beta team does, I haven't seen him in ages wink
Posted By: Tiger66 Re: [6.7] [beta] Hide Private Forums - 07/23/2005 4:26 AM
Yes by wings I ment categories, sorry, I did put it on another category just that when you have allot of staff rooms then you get a pretty big wing so was just wondering if it's possible to hide the categories too.

Thanks
Posted By: LK Re: [6.7] [beta] Hide Private Forums - 07/23/2005 1:09 PM
Untested:
Open public_forum_summary.pl.
Find in sub CategoryStrip:
Code
	return qq~
Replace with:
Code
$abcdefg = qq~
Find:
Code
} # end CategoryStrip
Add ABOVE:
Code
if ($catarray->[2] eq "NUMBER") {
return '<?php echo Privates(NUMBER2,"'.UBBCGI::escape($abcdefg) . '"); ?>';
} else {
return $abcdefg;
}
Now replace NUMBER with your private category number (click on the category, the number after "category=" is the category number), and replace NUMBER2 with a number of one of your hidden forums.
Posted By: Tiger66 Re: [6.7] [beta] Hide Private Forums - 07/26/2005 2:55 AM
Ok just tested it
If you set one room for mods and one for admins and log in as admin then it's fine

When you log as a mod then the room you see is merged with the category above, when you log as a member the only thing it shows is that :
Forum Topics Posts Last Post

line at the bottom of the last displayed category

And thanks LK
Posted By: LK Re: [6.7] [beta] Hide Private Forums - 07/26/2005 3:02 AM
1) You should change NUMBER2 to the number the mods can see.
2) That's odd.. What do you mean by "that line at the bottom of the last displayed category"? can I see a screenshot?
Posted By: Tiger66 Re: [6.7] [beta] Hide Private Forums - 07/27/2005 3:23 AM
Sorry I choosed the wrong number for the NUMBER2, it fixed both issues , now it just shows this when you are logged out

http://img.photobucket.com/albums/v111/tigerboy/softwares/cap2.jpg

That is my last public category on my board and there's nothing beneath it (except for a hidden wing which is working fine) The icon legend red X is not related, but somehow this gray line with the "0"'s started to appear after adding this mod (maybe something with my style settings?) , and this line at the bottom appeared after adding your modifications for the hidden wing (but both things shows only when you are logged out)

And another thing I hope it's ok to ask here, is it possible to set a different new posts icon for just one forum? for example on ubbdev something else instead of this lightbulb to appear on the new posts column next to just one forum
(I know there's an option for this on the Style Sheets I create but it doesn't change anything)

Thanks again smile
Posted By: Nightcrawler Re: [6.7] [beta] Hide Private Forums - 03/31/2006 7:11 AM
Quote
Originally posted by LK:

By wings, you mean categories? If so you can just put the private forums in another category.

Hop To: I'll fix it if there is a need.

The point of this hack is not that they won't know you have private forums, but that they won't be disturbed by that forum every time they go to Forum Summary. I don't know of anyone who actually uses the Hop To menu, so it doesn't really matter.
Actually, I have a secret forum that I'd like to keep secret. How would I hide the forum from "hop to."
Posted By: LK Re: [6.7] [beta] Hide Private Forums - 04/01/2006 11:45 PM
Try the following:
in public_common.pl, find: (TWICE)
Code
			next FORUM if $vars_forums{$f}->[3] ne "On";
Add below:
Code
			next FORUM if $f == NUMBER;
Replace NUMBER with the number of the forum you'd like to hide, for example if you'd like to hide forum 3 add:
Code
			next FORUM if $f == 3;
Posted By: Nightcrawler Re: [6.7] [beta] Hide Private Forums - 04/02/2006 12:13 AM
Wow. That works beautifully. Thanks! thumbsup

I did notice one other thing that happens with this hack. When I'm logged out, I can see a 0 directly below the Recent Visitors row. It doesn't show when I'm logged in as an Admin (and can see the hidden forum) or as one of my dummy accounts (who can't see the forum) - just when I'm not logged in at all.

http://www.legionworld.net/cgi-bin/ultimatebb.cgi
Posted By: LK Re: [6.7] [beta] Hide Private Forums - 04/02/2006 12:19 AM
Where is the hidden forum located (if I could see it)? Is it under "Science Police Headquarters"?
Posted By: Nightcrawler Re: [6.7] [beta] Hide Private Forums - 04/02/2006 12:20 AM
It's forum #6, so it shows above "Encyclopedia Galactica."

I can give you the log in details to one of my dummy accounts and give it permission to the forum, if you need it.
Posted By: LK Re: [6.7] [beta] Hide Private Forums - 04/03/2006 4:16 PM
That's odd... Try the following in ubb_lib.cgi:
Find:
Code
sub check_private_access2 {
my (@profile, $Moderator);
&RequireVars("$vars_config{VariablesPath}/vars_mods.cgi");

# since forum is private, user must be logged in

# $_[0]: forum number
# $_[1]: forum password (blank, if none)

if (!$username) { return 0; }
Repalce with:
Code
sub check_private_access2 {
my (@profile, $Moderator);
&RequireVars("$vars_config{VariablesPath}/vars_mods.cgi");

# since forum is private, user must be logged in

# $_[0]: forum number
# $_[1]: forum password (blank, if none)

if (!$username) { return ""; }
Posted By: Nightcrawler Re: [6.7] [beta] Hide Private Forums - 04/04/2006 7:04 AM
Works great! Thanks again!
Posted By: Tiger66 Re: [6.7] [beta] Hide Private Forums - 05/25/2006 12:57 AM
Quote
Originally posted by LK:

Try the following:
in public_common.pl, find: (TWICE)
Code
			next FORUM if $vars_forums{$f}->[3] ne "On";
Add below:
Code
			next FORUM if $f == NUMBER;
Replace NUMBER with the number of the forum you'd like to hide, for example if you'd like to hide forum 3 add:
Code
			next FORUM if $f == 3;
One small problem is that it hides the forum from admins too
Posted By: LK Re: [6.7] [beta] Hide Private Forums - 05/31/2006 2:01 PM
There's nothing (simple) to do against it, since it is cached, so whatever the average user sees, so does the administrator.
© UBB.Developers