The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
HowTo Create Custom Usergroup Permissions
Usergoup Permissions are being controlled through XML files, you don't have to edit usergroup.php anymore To create your own usergroup permissions, the first thing to do is to modify table usergroup (keep table prefixes in mind!): [sql]ALTER TABLE usergroup ADD myhackpermissions INT( 10 ) UNSIGNED DEFAULT '0' NOT NULL ;[/sql] If your hack does need some integer settings as well (and not just On/Off-Options): [sql]ALTER TABLE usergroup ADD myhackintset INT( 10 ) DEFAULT '100' NOT NULL ;[/sql] Then you must create a an XML-File bitfield_myhack.xml and place it in includes/xml: HTML Code:
<?xml version="1.0" encoding="ISO-8859-1"?> <bitfields product="vbulletin"> <bitfielddefs> <group name="ugp"> <group name="myhackpermissions"> <bitfield name="canfoo" group="my_hack_permissions" phrase="can_foo_forum" install="1,2,3,4,5,6,7">1</bitfield> <bitfield name="canbaa" group="my_hack_permissions" phrase="can_baa_forum" install="">2</bitfield> <bitfield intperm="true" name="myhackintset" group="my_hack_permissions" phrase="myhack_int_desc"></bitfield> </group> </group> </bitfielddefs> </bitfields> Parameter product of Tag bitfields should be the identifier of your Product Paramater name of Tag group must match the column name in table usergroup. The Parameters for Tag bitfield are:
The value of <bitfield> is the decimal value of the bit (eg. 1 for the first, 2 for the second, 4 for the third, and so on). In case of an Integer Option this is the default value. If you want to hide certain permission groups for some usergroups, for example from Guests as they don't make sense for them: HTML Code:
<ignoregroups> <group name="myhackpermissions" ignoregroups="1" /> </ignoregroups> Place this section below the <bitfielddefs>-Section. Now create the necessary phrases (in Phrasegroup Permissions) at this point. As vBulletin caches Bitfields in Datastore, you must rebuild this cache before the new usergroup permissions can be actually used (They will already show up in Usergroup Manager, but cannot be saved - you will get an error). To do so, point your browser to admincp/index.php?do=buildbitfields. You can also use the following Code (in a Custom Installer or Install-Code of a Product) to update the Bitfield Cache: PHP Code:
This How-To is (C) 2005 by KirbyDE and you are not allowed to redistribute it in any way without my explicit consent. |
#32
|
||||
|
||||
very nice,
thank you! |
#33
|
|||
|
|||
KirbyDE .... Great How-To!!
One thing I would like to point out to everyone which I think is extremely relevant to this thread is the install="X" field will not be recognized during a product installation script ... at least not without extra code which I haven't figured out how to write yet. Simply rebuilding the bitfields (while it will allow the new permissions to begin functioning) will result in all zero's as default for all groups. http://www.vbulletin.com/forum/bugs3...iew&bugid=1054 This is the vBulletin response. Quote:
Maybe someone else will have better luck than me. |
#34
|
||||
|
||||
Untested, but
PHP Code:
|
#35
|
|||
|
|||
You were close Kirby
You only forgot the WHERE usergroupid=$usergroupid in the query. Works like a charm!!! Thank you, Sir!! PHP Code:
|
#36
|
||||
|
||||
I knew there was a reason why I specified a Variable for the Key in foreach()
|
#37
|
||||
|
||||
lol... Kirby, might I ask why I'm in your signature?
|
#38
|
||||
|
||||
Yes. I've read this Post you made and found it very amusing
|
#39
|
|||
|
|||
Can anyone verify or deny for certain if two of the same "canfoo" bitfield names can exist as long as they are each under a different groupname?
For example, something like "canview" under groupname "bluntswhodlpermissions". I could see almost every hack using a "canview", LOL, but the groupname is very unique. I ask because I do see a lot of vbulletin code which checks for clashes, but the code gets a little too deep for me to fully understand so far. I ask in this thread to help reinforce this how-to. I mean if we must all diversify this variable as well, then maybe the how-to should reflect that we should put part of our myhack name in this too somehow .... or maybe we are all good with real simple short vars here if duplicate canfoo's are ok as long as the groupname is unique. I suspect the latter, but I leave it as a question. Just trying to help avert potential problems down the road while we are all learning the vb350 ways. |
#40
|
||||
|
||||
You can have "canfoo" in myperms1, myperms2, mypers3, doesntmatterperms and so on - doesn't cause Problems, as they are different Bitfields and those Names are just Shortcuts for the Bits
|
#41
|
|||
|
|||
3 thumbs up for Kirby!!
Appreciate the time!! |
#42
|
||||
|
||||
Quote:
|
#43
|
|||
|
|||
Can you make a specific user be allowed to use html?
If so, how? EDIT: hey, I have an idea, could I make a secondary usergroup that has it enabled, put the desired user as secondary usergroup for it, but have him display as his primary one? Will that work? If not.....what will? sorry guys...wrong thread. rofl... |
#44
|
||||
|
||||
Yes it will work, if the primary usergroup does allow membergroups.
|
#45
|
|||
|
|||
i am pretty sure there is a plugin for that which may make things a little neater....
|
#46
|
|||
|
|||
I got the same error someone else got about the escape strings
In the product I have I put that "Rebuild Bitfields" script Andreas wrote Code:
<plugins> <plugin active="1"> <title>Testimonialss</title> <phpcode><![CDATA[ // Rebuild Bitfields require_once(DIR . '/includes/class_bitfield_builder.php'); vB_Bitfield_Builder::save($db); $myobj =& vB_Bitfield_Builder::init(); $groupinfo = array(); for ($x = 1; $x < 9; $x++) { $groupinfo["$x"]['mypermissions'] = 0; } foreach ($myobj->data['ugp']['mypermissions'] AS $permtitle => $permvalue) { if (empty($permvalue['group'])) { continue; } if (!empty($permvalue['install'])) { foreach ($permvalue['install'] AS $gid) { $groupinfo["$gid"]['mypermission'] += $permvalue['value']; } } } foreach ($groupinfo AS $usergroupid => $permissions) { $db->query_write("UPDATE " . TABLE_PREFIX . "usergroup SET mypermissions=$permissions[mypermissions] WHERE usergroupid=$usergroupid"); } build_forum_permissions();]]></phpcode> </plugin> </plugins> Here's my bitfield Code:
<?xml version="1.0" encoding="ISO-8859-1"?> <bitfields product="testimonials"> <bitfielddefs> <group name="ugp"> <group name="testimonials"> <bitfield name="can_mod_testimonials" group="testimonials_permissions" phrase="can_mod_testimonials" install="">1</bitfield> </group> </group> </bitfielddefs> </bitfields> |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|