The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Custom Usergroup/Forum Permissions Details »» | |||||||||||||||||||||||||
Description:
This product is a framework which simplifies the creation and management of custom usergroup permissions and their associated custom forum permissions. There are tutorials on how to perform these types of modifications to the vBulletin system; however, this is a common part of many vBulletin add-on products and I didn't want to have to write separate code to do this same thing for all of my forthcoming vBulletin products. Since this product allows the arbitrary addition of custom usergroup permissions, I thought it may have value to others as well. Of significant note, this product does not use any of the vBulletin standard fields, specifically the forumpermissions field of the forumpermission table. Many of the tutorials I've seen online either only discuss adding usergroup permissions (and do not delve into how to extend usergroup permissions to forum usergroup permissions) or they suggest using the forumpermissions field of the forumpermission table (unused bits...). The former situation simply lacks the depth that many of us need; that is, we want full 'forum usergroup' permissions, not simply 'usergroup' permissions. The latter issue is simply a very poor design choice: who knows when the vBulletin system will begin using the as yet unused bitfields in the forumpermission.forumpermissions field or when two add-on products try to contend for the same bits in that field? A better solution is to standardize a process whereby each of your products adds a new field to the forumpermission table which will store your product-specific custom usergroup data. This ensures your product won't run into problems if the user upgrades vB or installs other add-on products. CustomUGP addresses these issues. It eliminates most of the real downside with taking this approach, namely that you would have to implement code to handle the custom forum permissions. The disadvantage with the solution as it currently stands is that you have to modify one of the existing vbulletin product files, specifically ./includes/adminfunctions.php. The edits are very minor; simply adding two new hooks (both of which have been requested to be added to a future release of vBulletin). Phew. I guess that about covers it. Requirements For installation: * Admin access to vBulletin 3.5.3 (untested on any other version) * FTP access to add new files to the vBulletin directory structure Requirements For Usage: * Basic familiarity with adding fields to your vB database (specifically, you will need to add a field to the forumpermission table to store your custom bitfields) * Basic understanding of how to create a product and the associated xml files, namely: yourproduct.xml and bitfields_yourproduct.xml * Admin access to vBulletin 3.5.x Installation:
Usage: [ADVANCED]
Obviously you could do something similar in a template, although I believe the recommended process would be to set these flags in a hook/php code mod and then refer to the variable in a template using a conditional as so: Code:
<if condition="$show['threadprivacy']"> <fieldset class="fieldset"> <legend>$vbphrase[threadprivacy_title]</legend> <input type="radio" name="threadprivacyoptions" value="0" checked />$vbphrase[threadprivacy_none]<br/> <if condition="$can['readonly']"> <input type="radio" name="threadprivacyoptions" value="1" />$vbphrase[threadprivacy_readonlyTitle]<br/> </if> <if condition="$can['memod']"> <input type="radio" name="threadprivacyoptions" value="2" />$vbphrase[threadprivacy_startermodTitle]<br/> </if> <if condition="$can['wemod']"> <input type="radio" name="threadprivacyoptions" value="4" />$vbphrase[threadprivacy_participantmodTitle]<br/> </if> <if condition="$can['private']"> <input type="radio" name="threadprivacyoptions" value="8" />$vbphrase[threadprivacy_privateTitle]<br/> </if> <br/> $vbphrase[threadprivacy_desc]<br/> <div id="userfield"><input id="threadprivacy_participants" type="text" style="width:$stylevar[messagewidth]" class="bginput" name="threadprivacy_participants" value=""/></div> </fieldset> </if> [BEGINNERS] There are several different ways to create new Usergroup Permissions using this product. The best way is to create a product. If you haven't done so before, read one of the tutorials and download a few products to use as guides. It is EXTREMELY SIMPLE to create a product. If you don't believe me, look at the product-customUGP.xml file. It is TRIVIAL. You can do it. One particular issue to note re: creating a product is that you can manually create a product using the standard vBulletin Admin Control Panel Product Manager and then define the various plug-ins, templates, admin help files, admin settings, phrases... that you need. Once you are satisfied, simply go back to the Product Manager and click export and the system will automatically export your product.xml file for you completely built! Ok, I've convinced you to create a product for the feature you are implementing...now what? I'd recommend reading the rest of this once before doing anything if you are new to this. The first step is to decide what Usergroup Permissions you need to create. These should be yes/no options (if they aren't, don't try to use this product). Once you've made that decision, you can get to the real work as follows:
Note: the above line of code is specific to the example bitfield I used above. Your code should look similar but reference the individual bitfields you specified in your bitfield file (instead of canprivate) as well as the name of the custom forum permission you are checking (threadprivacy_options in this case). System Changes: This product uses five hooks. Two are newly created hooks that have to be manually inserted into the adminfunctions.php file. This was necessary in order to cache the custom forum permissions after they are changed in the admin. Unfortunately I couldn't find a way around a manual file change; however, I have requested that these hooks be added into a future release of vBulletin and I'm hopeful that at some point it will be done (hopefully they'll just modify vBulletin to support this feature and remove the need for this customization entirely). The other three are hooks already in vBulletin and are used to automate the handling of the custom permissions you need (that is, to display and save the information). There are no database changes required to install this product; however, using the product requires you to alter the database as mentioned above. There product includes one new php file and 1 xml file. Limitations: This code was developed to work only with bitfield-type permissions, that is Yes/No situations. Problems:
Potential Issues/Cautions:
Supporters / CoAuthors Show Your Support
|
Comments |
#2
|
||||
|
||||
Wow, must have taken quite a bit of time.
/me pats on the back and clicks install |
#3
|
|||
|
|||
Actually, it was my first vB mod and it only took about 3 days. I've been using it for about a week now and didn't run into any problems but I'm guessing there are some gotcha's I haven't found yet but so far so good.
The next mod I'm releasing Thread Privacy...I needed this hack to accomplish that though so this project put that one back a few days. Hopefully I can release that one by Friday now that this it out. |
#4
|
|||
|
|||
Quote:
Waiting for ur next mod. |
#5
|
||||
|
||||
Is there a screenshot or something?
|
#6
|
|||
|
|||
I added two screenshots...one shows the new admin setting that you must populate to activate the feature. The other screenshot shows 4 new permissions on the Forum Permissions page. These examples are from my dev box as I'm finishing up another product which supports private and semi-private threads.
|
#7
|
|||
|
|||
I just updated the instructions a bit. I don't think I gave any examples of how to access these permissions in your templates/pages to control behavior...not much use if you aren't going to do that...it is, I hope, fairly intuitive, but an example couldn't hurt.
|
#8
|
||||
|
||||
Joe,
I notice that in 3.7 these hooks seem to have finally been added to vB. Maybe you'd like to update this mod and re-release it for 3.7? This is the only serious attempt I've seen at trying to work round the custom forumpermissions issue, and I'd like to see it resurrected. Now that it doesn't need a code edit, it's a much more realistic solution. Shame about the Permissions Duplication stuff. -- hugh |
#9
|
|||
|
|||
Hello.
I'm very impressed for your hack. How about with vB4.x? My works is going to Usergoup disable to view excludable forum. To perform this, I look at forum filter but I didn't know how the feature should be code. https://vborg.vbsupport.ru/showthrea...26#post2046926 My questions is very rudimentary as, https://vborg.vbsupport.ru/showpost....&postcount=119 I'm newb. Let me know. Thank you. |
Thread Tools | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|