PDA

View Full Version : [RELEASE v2.x.x] Improved USER ACCESS MASKS interface!


merk
19 Sep 2001, 07:03
Purpose: I run many many forums(120+ including subcatagories) so i needed a more efficient way of controlling access masks(there is an infinite combination of usergroups if i was to use that method.)

So set about creating a better system.

For an example, view the attachment. (default setting=green, yes=red, no=blue).

Installation:

First, you need to open up adminfunctions.php in the /admin/ directory and add (just before the ?>)


// ###################### Start makeoptioncode #######################
function makeoptioncode ($value="",$description, $selected="", $color="green") {
// similar to makeinputcode, only for a text area

echo "\n<OPTION value=\"$value\" $selected style=\"color:$color\">$description</option>";
}


Then go into user.php in the /admin/ directory
Go to ~~ 358 and find

// ###################### Start Edit Access #######################

/*if ($action=="editaccess") {


Delete everything from that point to

doformfooter("Save Changes");
}


(Thats just the edit access bit, nothing else!)

Then, put where that was

// ###################### Start accessmasks function #######################
function accessmasks($parentid=-1) {
global $DB_site, $userid, $forumid;
$forums=$DB_site->query("SELECT forumid,title,displayorder FROM forum WHERE parentid=$parentid ORDER BY displayorder");
while ($forum=$DB_site->fetch_array($forums)) {
$accesslist=$DB_site->query_first("SELECT * FROM access WHERE userid='$userid' AND forumid='$forum[forumid]'");
if ( is_array($accesslist) )
{if ($accesslist['accessmask']==0)
{$sel = 0; $tempcolour="blue";}
elseif ($accesslist['accessmask']==1)
{$sel = 1; $tempcolour="red";}
else {$sel = -1; $tempcolour="green";}}
else
{$sel = -1; $tempcolour="green";}
echo "<li><div style=\"color:$tempcolour\"><b>$forum[title]</b>";
echo " > > > <SELECT name=\"accessupdate[".$forum['forumid']."]\" style=\"font-size: 7pt; background-color: #dfdfdf; font-family: Arial, Tahoma;\" maxlength=\"20\">";
makeoptioncode(1,"Yes",iif($sel==1,"selected",""),"red");
makeoptioncode(0,"No",iif($sel==0,"selected",""),"blue");
makeoptioncode(-1,"Default",iif($sel==-1,"selected",""),"green");
echo "</select></div>\n\n";
echo "<input type=\"hidden\" name=\"oldcache[".$forum['forumid']."]\" value=\"$sel\">";
echo "<ul>";
accessmasks($forum[forumid]);
echo "</ul>\n";
echo "</li>\n";
}}

// ###################### Start modify #######################
if ($action=="editaccess") {
$user=$DB_site->query_first("SELECT username FROM user WHERE userid='$userid'");
doformheader("user","updateaccess",0,0);
makehiddencode("userid","$userid");
echo "<div align=center><h3>User Forum Access for <i>$user[username]</i></h3></div>";
echo "<tr class='firstalt'><td colspan=2><p>Here you may edit forum access on a user-by-user basis.
<BR>Selecting \"yes\" will allow this user access to the forum. Selecting \"no\" will deny this user access to the forum. Any changes made to this user's account will override the default permission settings in their usergroup.
<br><br>Selecting \"default\" will revert this user to the default permissions settings for their usergroup.
<BR><br>(Please note that the permission inheritance system still works here)
<br><br>(Ensure that you have access masks enabled before attempting to use these!)</p></td></tr>\n";
echo "<br>";
echo "<ul>\n";
accessmasks(-1);
echo "</ul>\n";
doformfooter("Save Changes");
}


Thats it!

PS. Devlopers / Moderators - i wasnt sure if i copied and
pasted too much code in the above, well actually i rewrote most
of it, but based on your principles in the modify forums section. If
its too much, please feel free to delete it, but because i didnt
know...!

Demo Screenshot attached

merk
19 Sep 2001, 07:09
Please excuse the blurryness of the font in the screenshot, thats just windows XP antialiased fonts in action ;)

[VbbFr]Elie
19 Sep 2001, 19:54
It's Working Very Well :)

I make a ScreenShot and and a French Version ...

DarkReaper
19 Sep 2001, 20:34
What exactly does this do? I'm not too clear on it.

Also, will it work with your other "allow mods to modify access masks" hack?

When will your hack for allowing mods to edit their forums styles come out? I really need that one and would be willing to (try)help you.

[VbbFr]Elie
19 Sep 2001, 22:07
ScreenShot [http://basf.multimania.com/screenshot.jpg]
French Version [New.Acces.Masks.Design.FR.Elie-VBBFR.zip]

merk
20 Sep 2001, 00:50
Originally posted by DarkReaper
What exactly does this do? I'm not too clear on it.

Also, will it work with your other "allow mods to modify access masks" hack?

When will your hack for allowing mods to edit their forums styles come out? I really need that one and would be willing to (try)help you.

This hack, rearranges the accessmasks for the adminCP. it doesnt effect the modcp hack.

It rearranges the Accessmasks per user screen to be more readable.

And the styles hack is almost complete, im just adding a few more features.

DarkReaper
20 Sep 2001, 04:15
Great! When are you going to release it? What features are in it/are you adding?

merk
20 Sep 2001, 05:18
Im adding features that contain options on what you will allow to be modified. Also making the code a bit neater.

However, because of the recent release of the Halflife 1108 patch, my server was taken down, in reflex action of my host, simply because i was hosting the files, and peaking at 3mb/sec(which is alot for a webserver, maybe i should have warned them? :))

Anyway, it should be back up in about an hour, ill try get it done then.

DarkReaper
20 Sep 2001, 12:57
Ok, I'm impatient :)

Been several hours, where is it!? ;);)

merk
20 Sep 2001, 13:25
Its actually alot more complex than i thought it would be.

That, and i still havent got my ftp back online :|

Im sorry for taking so long, but at the moment, australian internet is really buggered, it just wont do anything with international pages, im lucky i got this far here.

The weekend is fast approaching, and i should have it done, hopefully by tommorow night my time.

I hope its not a empty promise either! :(

Dont worry, itll be here soon, just its a pain to write how to put it together, considering that im not allowed to just paste it :|

DarkReaper
20 Sep 2001, 20:10
I'd be happy to help you with it. Check your PMs for my email(I get enough SirCam email already, don't want to post it publically :)).

Martz
20 Sep 2001, 23:59
Another excellent hack, I like it - thanks for sharing :) I wonder if a Usergroup version of this one could be made? :D Another vB admin nightmare out of the way :)

merk
21 Sep 2001, 00:13
Originally posted by Martz
Another excellent hack, I like it - thanks for sharing :) I wonder if a Usergroup version of this one could be made? :D Another vB admin nightmare out of the way :)

Im not sure what use this would be for 'usergroups'.

If by chance you mean 'Modify Forums' with that massive list of usergroups for each forum, im already working on that one, well i actually started it before :)

All ive basically done, is make all of the sublists foldable trees. You might have seen this somewhere, for example, press F1.

IE Required, but i was thinking of making it alot more simple, as in have the first five letters of each usergroup, and have them all on one line.

Having 120+ forums with 12 usergroups.... :(

I hope thats what you mean? :)

DarkReaper
21 Sep 2001, 01:30
This is a great hack, but I think I use stuff like this for usergroups in general more than I do for specific users :)

So, I'd love that one to be made :D

Martz
22 Sep 2001, 17:08
Originally posted by merk


Im not sure what use this would be for 'usergroups'.

If by chance you mean 'Modify Forums' with that massive list of usergroups for each forum, im already working on that one, well i actually started it before :)

Having 120+ forums with 12 usergroups.... :(


Yep, Modify Forums is the one I was thinking of - its a nightmare at the moment when I add a new usergroup it has default permissions on existing private forums, so I gotta go through them all and set them :( Time consuming processes, and takes a lot longer each time a new forum or group is added :/

Anyway, if I could change the usergroups either in the same way as above, or many at once (current takes about 10 or more clicks for usergroup, per forum) I would be a lot happier! :)

the_sisko
23 Sep 2001, 00:16
Good job!

5 minutes and it was in my admin cp! Its much more easy now to config the accessmarks..! THANKS

merk
23 Sep 2001, 02:07
Originally posted by Martz


Yep, Modify Forums is the one I was thinking of - its a nightmare at the moment when I add a new usergroup it has default permissions on existing private forums, so I gotta go through them all and set them :( Time consuming processes, and takes a lot longer each time a new forum or group is added :/

Anyway, if I could change the usergroups either in the same way as above, or many at once (current takes about 10 or more clicks for usergroup, per forum) I would be a lot happier! :)

Yep, once ive finished the style hack, ill work on this one.

At the moment, i have a smart folding tree for it, which can be found at www.dynamicdrive.com , took a bit to get it to work, but im going to change the system.

Going thru every forum it a nightmare! (im still thinking about a new method i can make)

merk
23 Sep 2001, 02:09
Originally posted by The_Sisko
Good job!

5 minutes and it was in my admin cp! Its much more easy now to config the accessmarks..! THANKS

No Problems! :)

Good to see another satasified customer! :D

DarkReaper
23 Sep 2001, 02:12
Customer, lol. Check your email :)

merk
23 Sep 2001, 02:22
I checked my email about 3 seconds before you emailed me, and closed it again :O

Lucky i was still browsing around here ;)

kchii
29 Sep 2001, 05:06
I must be missing something... I'm running 2.0.3, and I edited the code as instructed. When I selected Modify Forums, it looks the same as always.

DarkReaper
29 Sep 2001, 05:19
It changes it in /forums/mod. It allows your mods to add certain users to the access list of their forums.

YourHostSucks
02 Oct 2001, 21:20
Nice look man, Bravo* I like.

Simple couple sec's of editing, and works like a charm..

Thanks!

Jawelin
29 May 2002, 11:59
Very nice hack. I've been using it since you released.... !!

Now I noticed a small 'bug' or problem: there's some conflict about representing red or green light (i.e. retrieving the real permission) to child forum when inheritance is active both to usergroup permissions and access mask.

I definetively think that's due to a strange cache affecting getforumpermission() function (see HERE (http://www.vbulletin.org/forum/showthread.php?s=&threadid=38637) about).

The scenario is following:
i have a category and subforums; when a usergroup has default access granted to the category but not to the children, and the single user access masks grants that user (within usergroup) the permission to the category, that user is shown as having permission to access the children forum too.
Instead, VB says NO! : I mean, inheritance (both group or mask level) has lower priority than the child forum permission (both group or mask level).
At same level of inheritance, instead, access mask is stronger than usergroup permission... :)

Hope I explained well enough. That's the problem, but I can't manage to solve it when showing an user whatever able or not to see a given forum...

Thank you for support.

Bye

Minots
13 Jun 2002, 08:15
THX a lot.
Works fine 4 me. :]

*AKA*Geo*A*
02 Jul 2002, 21:50
is there any way to get this to work in the moderators control panel????

Alpine_Z
08 Nov 2002, 11:46
This is a great hack, I like it - thanks for sharing

gggforums
12 Nov 2002, 15:12
Works great in a virgin install of 2.2.8 - thanks for being my first hack, and a successful one at that!