Back to vBulletin 3 Articles

HowTo Create Custom Usergroup Permissions
by Andreas 10 Jun 2005
Rating: (1 vote - 5.00 average)

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 Query: (https://www.vbulletin.com/docs/html/maintenance_query" target="new">how to run queries)
ALTER TABLE usergroup ADD myhackpermissions INT( 10 ) UNSIGNED DEFAULT '0' NOT NULL ;

If your hack does need some integer settings as well (and not just On/Off-Options):

SQL Query: (how to run queries)
ALTER TABLE usergroup ADD myhackintset INT( 10 ) DEFAULT '100' NOT NULL ;

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>
As you can see, you must create a new permission group below group ugp (short for usergroup permissions).

Parameter product of Tag bitfields should be the identifier of your [How-To] Product Managament (vBulletin 3.5 RC 1 and up)) to update the Bitfield Cache:
PHP Code:
if (is_newer_version('3.5.1'$vbulletin->options['templateversion']))
{
    
// Rebuild Bitfields
    // Do this for vBulletin < 3.5.1 *ONLY*; later versions rebuild
    // automatically and calling the builder in install code causes
    // the bitfields NOT to be rebuild correctly
    
require_once(DIR '/includes/class_bitfield_builder.php');
    
vB_Bitfield_Builder::save($db);
    
build_forum_permissions();

If you install/upgrade vBulletin and custom bitfield_xxx.xml files are already in place, they will be used - you don't have to update the Bitfield Cache in this case.

This How-To is (C) 2005 by KirbyDE and you are not allowed to redistribute it in any way without my explicit consent.

Similar Mods

Custom Usergroup/Forum Permissions vBulletin 3.5 Add-ons

vblts.ru supports vBulletin®, 2022-2024