Coding in Vbulletin 3.x Tips
by
14 Feb 2005
Quick 1st Tip: Inserting new Vbulletin Settings by running a php script. sample code: PHP Code:
function setting_add($title, $description, $varname, $value, $defaultvalue, $optioncode, $displayorder,$grouptitle)
To run this function use: PHP Code:
setting_add('Setting title', 'Setting Descritption', 'varname', 'value', 'defaultvalue', 'typeofHTMLcode', 'displayorder','grouptitle');
Setting Descritption: The discription of the setting. varname: varname is cancloseboard => $vboptions['cancloseboard']. value: the default value. defaultvalue: MySQL default value. displayorder: the displayorder of the setting. grouptitle: if you want to have a brand new setting, then use a different value with vbulletin default grouptitle, it will be a child setting if you use a existed value. This is the most simple way to add a new setting AFAIK. just a 1st quick tips, there will be more, soon. 2nd Tip: Adding Usergroup Permission. This is simple, you need to edit 2 file: init.php and admincp/usergroup.php in init.php find: PHP Code:
// ----------------------------------------------------------
PHP Code:
$_BITFIELD['usergroup']['permissionname'] = array(
in admincp/Usergroup.php find: PHP Code:
print_table_header($vbphrase['forum_viewing_permissions']);
PHP Code:
print_table_header('Permission Name');
to check for permission in php vb files, use: PHP Code:
if (!($permissions['permissionname'] & candothis))
PHP Code:
if (!($permissions['permissionname'] & 1))
Some notes: If you use a totally new usergroup permission like the example above you will then need to run some queries: this must be run: SQL Query: (how to run queries)
ALTER TABLE `usergroup` ADD COLUMN `permissionname` int(10) unsigned NOT NULL DEFAULT 0 This is optional to add default permission for some usergroup: SQL Query: (how to run queries)
UPDATE usergroup SET jukeboxpermissions=63 WHERE usergroupid IN (5,6,7) this query set the admin, mod, smod usergroup to have full permission, the number 63 = 1 + 2 + 4 + 6 + 8 + 16 + 32, so if you want a usergroup to have full permission, just total all the number in that permission, and to disable any permission you extract that number. Admin will have candothis and candothat set to no if they're 60. For a exist permission you need to run no queries Simple place a new value with the correct number below the vb based permission. Example: PHP Code:
$_BITFIELD['usergroup']['calendarpermissions'] = array(
PHP Code:
print_yes_no_row($vbphrase['can_view_others_events'], 'usergroup[canviewothersevent]', $ug_bitfield['canviewothersevent']);
ADD BELOW PHP Code:
print_yes_no_row('Can Do anything', 'usergroup[cansearchevent]', $ug_bitfield['cansearchevent']);
I hope I am not just trying to be complex. Next: Forum permission. |