PDA

View Full Version : Read or change Custom Forum Permission


TitanKing
12 Jul 2005, 14:00
Well after a HELL of a strugle I figured this out, im sure itl help many more writing or trying to write a mod...

You can also change permission with this simple script...

First you need this set of Functions:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Now lets see what permission a specific user has with this :



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



You will get a return Value of say : 917503, this is actually a bitfield that when converted to Binary you get a bunch of switches 110111111111111111111, which controlls the permission of the Forum...

Now lets continue... things will start to make sense now...



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Notice the bits at next to each setting, this is the actual bit you will use with the defined variables in the function above, say you need to know if a specific user has "can_upload_attachments" permission for say ForumID = 3, you will do the following :



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



a Return value of 0 for false and 1 for true will be returned, the rest of the functions is to change permission the same way as above example...

An here is a little sample script how this can be used in practise...



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Cheers :squareeyed:

You may also need to know how to use the functions :



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

Psionic Vision
10 Oct 2005, 23:56
Where exactly can I use this?
These functions are not defined in vBulletin. Also, why would you want to create a new set of bitfields for forum permissions if vBulletin already has its own set?