Your Hack has an Admin Backend?
Then you should consider protecting it with custom Admin Permissions - not every Admin has to be able to control everything.
First of all, you have to decide on a uniqe Key for your Admin Permission, just like your Product ID.
In this example I will use canadminmyhack.
Go to your ACP File(s) and place the following Code below the Back-End requirement:
customadminperms[canadminmyhack] must the Name of the Bit(field) you want to use, $vbulletin->bf_misc_customadminperms['canadminmyhack'] the Value of the Bit
You must also create a Plugin for the Administrator Datamanager
admindata_start
Now, finally, we need a Plugin to actually check this Permission
can_administer
PHP Code:
foreach($do AS $field)
{
if ($admin['customadminperms'] & $vbulletin->bf_misc_customadminperms["$field"])
{
$return_value = true;
return;
}
}
Here again, $vbulletin->bf_misc_customadminperms['canadminmyhack'] must be the Value of your Bit.
As you can see, I used customadminperms as the Bitfield.
This is the Bitfield I will use for my Hacks, Bit 1 is already in use.
If others want to use it too (to avoid having to create there own (Bit)fields) - feel free to do so.
But please, first post here and state which Bit you are going to use and wait for an Okay so there won't be conflicts.
To use it, create an appropriate Bitfield XML File.
I have this in my custom XML file - the canadminnetwork option works fine, however the canadminrankings part (using your code) returns a value of 2 when Yes, or 0 when No.
I have this in my custom XML file - the canadminnetwork option works fine, however the canadminrankings part (using your code) returns a value of 2 when Yes, or 0 when No.
This is somewhat unrelated, but where can I get info on how to give my plugin an admincp back-end? I'm working on a small plugin for my forum and this would be very useful.
Hello, Andreas, I've a problem: The permissions are not stored. When I click save and return to the Permission Overview, The Right i snot saved. (No is ever selected)
First, Does this works with 3.6.0? If so what are the right steps to make it work.
Second, Any particular reason why doesnt save the permissions? it just don't do it, I have try in so many ways, but it appears vbulletin for some reason doesnt store the changes.
I am using vbulletin 3.6.0+
Also could you make this hack works with more than one custom permissions?
First, Does this works with 3.6.0? If so what are the right steps to make it work.
Second, Any particular reason why doesnt save the permissions? it just don't do it, I have try in so many ways, but it appears vbulletin for some reason doesnt store the changes.
I am using vbulletin 3.6.0+
Also could you make this hack works with more than one custom permissions?