Register Members List Search Today's Posts Mark Forums Read

Reply
 
Article Options
HowTo Create Custom Usergroup Permissions
Andreas
Join Date: Jan 2004
Posts: 6,863

Germany
by Andreas Andreas is offline 10 Jun 2005

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!):


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


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


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Then you must create a an XML-File bitfield_myhack.xml and place it in includes/xml:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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 Product

Paramater name of Tag group must match the column name in table usergroup.

The Parameters for Tag bitfield are:
  • name is the identifier you can use in your hack code (eg. $permissions['myhackpermissions'] & $vbulletin->bf_ugp['myhackpermissions']['canfoo'])
    In case of integer options this name must match the column name in table usergroup.
  • intperm indicates that this Option is a integer value
  • group is the varname for the Phrase that should be displayed as Permission Group Title.
    This is also being used to set up different Groups for your permissions.
  • phrase is the varname of the Phrase that should be displayed for this option in Usergroup Manager
  • install is a comma-separated list of the usergroups where this permission should be visible
    If this parameter is empty or omitted, this Option will be used for all Usergroups

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:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Parameter name is the name of the permission group you want to hide, ignoregroups is a comma seperated list of usergoup IDs where this permission group should not show up.
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:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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.

Last edited by Andreas; 22 Feb 2006 at 09:35..
Views: 47701
Reply With Quote
Comments
  #2  
Old 10 Jun 2005, 19:04
noppid noppid is offline
 
Join Date: Mar 2003
Very nice, no more chances of stepping on toes.

I think the field add for a custom permission, bitfield, may need to look like this instead...


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

__________________
Add a photo gallery garage to your auto forum and get noticed by your members. Find out how at the vBulletin Computer Help Forum.
An informed rider makes their first destination the motorcycle forum at rider info.

Last edited by noppid; 10 Jun 2005 at 19:10.
Reply With Quote
  #3  
Old 10 Jun 2005, 19:14
Revan's Avatar
Revan Revan is offline
 
Join Date: Jan 2004
Real name: Fillip
Good tut, I hope Administrator Permissions is next... *hint*
Reply With Quote
  #4  
Old 10 Jun 2005, 19:41
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Real name: Andreas
@noppid
Right. Should have been UNSIGNED of course, corrected
Reply With Quote
  #5  
Old 11 Jun 2005, 02:57
deathemperor's Avatar
deathemperor deathemperor is offline
 
Join Date: Jul 2003
Real name: Lucius Hunk
very very nice, this will boost the learning of vb3.5, no one wrote something like this for vb3.0
Reply With Quote
  #6  
Old 11 Jun 2005, 03:03
Danny.VBT's Avatar
Danny.VBT Danny.VBT is offline
 
Join Date: Oct 2004
Yay! This is what I was going to ask for!
__________________
Former vBulletin.org Staff Member

while($coffeeMachine->supply($Danny)) { $Danny->run(); }

Twitter Blog
Reply With Quote
  #7  
Old 11 Jun 2005, 09:36
burnist's Avatar
burnist burnist is offline
 
Join Date: Jul 2003
Real name: Stewart Ritchie
I think I love you KirbyDE
Reply With Quote
  #8  
Old 12 Jun 2005, 03:02
amykhar's Avatar
amykhar amykhar is offline
 
Join Date: Oct 2001
Real name: Amy
Question: Is there something similar for forum permissions?
__________________
amykhar.com
----------------------------------------
I do not respond to PM requests for coding assistance.
Reply With Quote
  #9  
Old 13 Jun 2005, 12:06
Shaved Shaved is offline
 
Join Date: Nov 2001
Im with amykhar I tried to apply this to forumperms but with no effect.

I want simple yes/no option. I even tried editing the bitfield_vbulletin.xml directly and no effect any help appreciated.

*edit *

Got it to work.

Note to self read full post before asking for help

Last edited by Shaved; 13 Jun 2005 at 16:31.
Reply With Quote
  #10  
Old 16 Jun 2005, 17:15
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Real name: Andreas
Update: Simplified instructions to rebuild Bitfield Cache.

@amykhar
You can extend the forumpermissions bitfield, however I fear this will cause problems sooner or later - 20 of 32 Bits are already being used.

To do so:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Last edited by KirbyDE; 16 Jun 2005 at 17:22.
Reply With Quote
  #11  
Old 18 Jun 2005, 01:24
Ron1n Ron1n is offline
 
Join Date: Jun 2004
Why cant this be added to bitfield_vbulletin.xml? I have tried, but it doesnt work.
Reply With Quote
  #12  
Old 18 Jun 2005, 01:29
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Real name: Andreas
It can ... but you shouldn't do that, as bitfield_vbulletin.xml will be overwritten during an upgrade, which means you would have to redo the changes.
If you use your own XML file it will still be there and used after an upgrade.
Reply With Quote
  #13  
Old 18 Jun 2005, 23:49
Ron1n Ron1n is offline
 
Join Date: Jun 2004
how does one go about putting a title on the grey table header? I tried phrase="_phrase_var_" and text="phrase text" but neither worked.
Reply With Quote
  #14  
Old 19 Jun 2005, 00:43
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Real name: Andreas
Quoting myself to answer your question:
Originally Posted by KirbyDE

The Parameters for Tag bitfield are:
  • group is the varname for the Phrase that should be displayed as Permission Group Title.
    This is also being used to set up different Groups for your permissions.
Reply With Quote
  #15  
Old 19 Jun 2005, 03:05
Ron1n Ron1n is offline
 
Join Date: Jun 2004
yea, i read that but figured I also needed another param because it wasnt (and isnt) working


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

download_permissions is a phrase that says Download Permissions

I'll try looking over everything to see if there are errors, but I dont see how I could have messed up.
Reply With Quote
Reply

Similar Article
Article Author Type Replies Last Post
Custom Usergroup/Forum Permissions joefitz vBulletin 3.5 Add-ons 8 14 Feb 2011 18:23



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Article Options

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


New To Site? Need Help?

All times are GMT. The time now is 14:39.

Layout Options | Width: Wide Color: