PDA

View Full Version : Private Forum Improvement


amykhar
11-28-2001, 10:00 PM
It irked me to no end that when I added a new usergroup, they had access to all private forums if I wasn't careful. Thus, I wrote this.

It should also be useful for other things. With this field in the forum table, queries to exclude private forums are MUCH easier.

Do not download this attachment for new installs. Download this one (https://vborg.vbsupport.ru/showthread.php?postid=363858#post363858)

Tommy Boy
11-29-2001, 05:23 PM
Can you please explain in more details what this hack does?

I have a similar problem, that when I opened a new hidden forum, all people who had access to the first one also had access to the new one, and I don't like it. Will your hack help me?

amykhar
11-29-2001, 05:40 PM
What it does is when you create a new private forum or make a forum private that wasn't private before, it sets a field in the database to mark it as private.

Then, when you create a new user group, it sets the forumpermissions to can't view for all private forums. This way, you can create a new group and not have them see your private forums by default.

I am not 100% sure, but cutting this code:


$mods=$DB_site->query("SELECT DISTINCT moderator.userid FROM moderator,user WHERE moderator.userid=user.userid AND user.usergroupid<>6 AND user.usergroupid<>5");
if ($DB_site->num_rows($mods)) {
while ($mod=$DB_site->fetch_array($mods)) {
$accessto[] = $mod['userid'];
}
while ( list($key,$userid)=each($accessto) ) {
$DB_site->query("INSERT INTO access (userid,forumid,accessmask) VALUES ('$userid','$forumid',1)");
}
}
}


out of your forum.php file should fix your problem for NEW forums that you create. However, if you take an existing forum and make it private, the same thing would still happen. I will investigate the code for changing a forum a little closer and see if I can't get that fixed as well.

Amy

Admin
11-30-2001, 11:15 AM
Just one thing. :)

Instead of this:
$tempGroupid=$DB_site->query_first("Select usergroupid from usergroup ORDER BY usergroupid DESC limit 1");
You can simply do this:
$tempGroupid=$DB_site->insert_id();
For more info:
http://www.php.net/manual/en/function.mysql-insert-id.php

:)

amykhar
11-30-2001, 11:37 AM
Cool. I learn something every day.

Amy

DarkReaper
12-15-2001, 07:57 PM
Hm...ok. Lets say I have 2 private forums already, and all moderators and admins have access to it. I then create another private forum, but want the moderators for that one not to have access to the previous forum, and I don't want any existing moderators to have access to the forum I just created. Can I do this?

Wayne2k1.com
03-28-2002, 01:13 PM
[QUOTE]Originally posted by DarkReaper
Hm...ok. Lets say I have 2 private forums already, and all moderators and admins have access to it. I then create another private forum, but want the moderators for that one not to have access to the previous forum, and I don't want any existing moderators to have access to the forum I just created. Can I do this?

The Red Devil
03-09-2003, 09:15 PM
Installed the hack, but it dont work for me. Im using 2.3.0
Everything is added and I get no error messages, but the new usergroup's I make still got access to all "hidden" forums.

Wayne2k1.com: A quite fast and easy solution to your problem would be to make another usergroup and make that "moderators" too, then edit the settings on who got rights of the usergroups to view the different forums.

amykhar
03-09-2003, 09:18 PM
This is a real oldie and I can't guarantee it works anymore. I don't use it because I don't install more usergroups.

Amy

Dean C
03-10-2003, 04:12 PM
Wow this is an oldie but a lovely idea :)!

How do i miss these hacks :p?

- miSt

amykhar
03-10-2003, 05:12 PM
I think I need to look at this one again. I did it way back when I barely knew a thing about VB. There might be a better or more efficient way to handle this. Off to play :)

Amy

amykhar
03-10-2003, 07:59 PM
OK. I have improved things slightly by getting rid of the extra queries in admin/forum.php

You do not have to upgrade. The hack still works as written. I believe the person having problems didn't remember to update his forum settings in private forums.

If you want to upgrade, simply uninstall the changes in admin/forum.php and use the changes in this new file. I am going to leave the original file in the first post to aid with uninstalls.

Don't forget, after you install this hack, you MUST go update the settings on existing private forums or new usergroups will have access to them.

Amy

dnd
03-11-2003, 03:00 AM
[QUOTE]Originally posted by amykhar


Don't forget, after you install this hack, you MUST go update the settings on existing private forums or new usergroups will have access to them.

Amy

amykhar
03-11-2003, 01:04 PM
No. Open the modify forum screen, make sure it's checked private and then click submit even if you made no changes. That makes sure the value is updated in the new column.

Amy

Talisman
03-13-2003, 09:26 PM
Looks like a very good hack to install...... but how many queries does this add?

amykhar
03-14-2003, 01:07 PM
None to the day-to day operation of your board. Only 1 extra when you are adding a new usergroup.

Amy

Talisman
03-14-2003, 02:22 PM
That's great. Thanks, Amy.

Boofo
03-18-2003, 07:04 AM
[QUOTE]03-10-03 at 03:59 PM amykhar said this in Post #12 (https://vborg.vbsupport.ru/showthread.php?postid=363858#post363858)
OK. I have improved things slightly by getting rid of the extra queries in admin/forum.php

You do not have to upgrade. The hack still works as written. I believe the person having problems didn't remember to update his forum settings in private forums.

If you want to upgrade, simply uninstall the changes in admin/forum.php and use the changes in this new file. I am going to leave the original file in the first post to aid with uninstalls.

Don't forget, after you install this hack, you MUST go update the settings on existing private forums or new usergroups will have access to them.

Amy

amykhar
03-18-2003, 01:34 PM
You may if you would like. It will work either way.

Amy

Deimos
03-18-2003, 03:09 PM
Love this hack, it makes things SO much easier!
I've got about...20-25 private forums that I have to normally Untick when making a new member group
Thanks alot Amy :)

amykhar
03-18-2003, 05:51 PM
Glad you like it :)

Amy