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. |
#82
|
|||
|
|||
I wonder why the "INSTALL" bit never works correctly. If I install such xml, all settings are initially off, regardless of install value.
|
#83
|
|||
|
|||
thanks Andreas for this nice custom usergroup permission howto...
i used to make my usergroup permissions with a plugin in the hook 'admin_usergroup_edit', but i needed 1 column in 'usergroup' table for each permission (too bad for lots of new perms) but now this xml really rocks |
#84
|
|||
|
|||
EDIT: Got it fixed
|
#85
|
||||
|
||||
how do you check for INT Permissions?
|
#86
|
|||
|
|||
So can you just do:
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</bitfield> </group> </group> </bitfielddefs> </bitfields> PHP Code:
|
#87
|
|||
|
|||
I couldn't get it to work so I made my own function in the hook "global_start".
I kept everything else the same but removed "can_administer". I had to use this query to add the field to the "administrator" table. PHP Code:
I put this in global_start PHP Code:
PHP Code:
|
#88
|
|||
|
|||
Very helpfull topic. Could you please extend it a bit saying me how I can set a default value per bitfield (for all usergroups) ?
I've the following code in bitfield_vbmates.xml Code:
<?xml version="1.0" encoding="ISO-8859-1"?> <bitfields product="vbmates"> <bitfielddefs> <group name="ugp"> <group name="vbmates"> <bitfield name="canuse" group="vbmates_permissions" phrase="vbmates_can_use">1</bitfield> <bitfield name="canadd" group="vbmates_permissions" phrase="vbmates_can_add">2</bitfield> ..... and others below.......... </group> </group> </bitfielddefs> </bitfields> Code:
if(!$permissions['vbmates'] & $vbulletin->bf_ugp['vbmates']['canadd']){ $vbulletin->url = "vbmates.php?" . $vbulletin->session->vars['sessionurl'] .""; eval(print_standard_redirect('vbmates_no_add_profile', true, true)); } 1.- I changed bitfield_vbmates.xml after the first product installation 2.- I've also trying to use in this file: <group name="vbmates_permissions"> but no chance. Ok, I found it. It needed one couple of parenthesis more. Instead of: if(!$permissions['vbmates'] & $vbulletin->bf_ugp['vbmates']['canadd']) should be ... if(!($permissions['vbmates'] & $vbulletin->bf_ugp['vbmates']['canadd'])) |
#89
|
||||
|
||||
Hi, can you help me a bit in this problem?
My bitfield_get_direct_links.xml: HTML Code:
<?xml version="1.0" encoding="ISO-8859-1"?> <bitfields product="get_direct_links"> <bitfielddefs> <group name="ugp"> <group name="get_direct_links_permissions"> <bitfield intperm="true" name="get_direct_links_number" group="get_direct_links_permissions" phrase="get_direct_links_number_desc">5</bitfield> </group> </group> </bitfielddefs> </bitfields> PHP Code:
PHP Code:
Can you help me? Thank you very much! PS: Sorry for my bad English |
#90
|
|||
|
|||
I have some problems with an int bitfield.
<bitfield intperm="true" name="myhackintset" group="my_hack_permissions" phrase="myhack_int_desc"></bitfield> Its baiscally like this one, only difference is it installs to all usergroups, including custom usergroups. Well my problem is this, i want to check if a person is in two usergroups, but one of the usergroups bitfield is set to 0. Example, Registered usergroup setting is 0, but Custom usergroup setting is 1. Instead of taking the 1 as the value, i need the 0. Anyway to do this? Hope thats clear. |
#91
|
|||
|
|||
Hello.
How to change a custom bitfield_xx.xml parameter via vB Options? For example, as I add new usergroups, I want to update the 'install' or 'ignore' param (e.g. comma-separated value) via ACP vs. editing the file. Is that possible e.g. putting an ACP variable in the xml file? Thanks in advance. Update: Using a variable in the 'xml' file is not necessary but vB requires code revisions in order to update bitfield 'usergroups' via ACP vs. modifying 'bitfield_xx.xml' file. It may be better to work with the 'ignoregroups' feature in usergroups.php combined with vBulletin Options' User Profile Options instead of the 'install' parameter of the 'xml' file since 'ignoregroups' works in v.3.6.3 after installation whereas, it seems that the 'install' parameter of <bitfields> is only recognized during new installations. |
Thread Tools | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|