MyBB Community Forums

Full Version: Plugin way -> AdminCP Permissions
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I noticed it isn't easy to add new permissions to the board.

For new adminpermissions you can do something like that in adminoptions:

if($mybb->input['action'] == "updateperms")
...
tableheader($lang->edit_perms);
tablesubheader("$tsub");
foreach ($permissions as $key => $value)
{
  if ($key == 'uid' || $key == 'cpstyle' || $key == 'notes' || $key == 'permsset') continue;
  makeyesnocode($lang->$key, "newperms[$key]", $value);
}
endtable();

You need to rename the language vars for the permissions. But its many times easyer to add or remove an option by doing an database query and add the language var.

Later you can add functions which help to extend these parts by modify the code itself.
If you check out MM's eMods system, it already adds this functionality to the admin CP. It also allows you to add items to the left hand nav panel.
decswxaqz Wrote:If you check out MM's eMods system, it already adds this functionality to the admin CP. It also allows you to add items to the left hand nav panel.

This is the suggestion forum for the MyBB or I'm wrong? So why should I install an Mod system if it can be done in core pack.

If I only need a custom admin permission more to check it in some other files I don't realy want to mod the board first.

So it was later usefull to include some function which can do this like:

Code:
// name, default, lang array or single val.
$mybb->addadminpermission('candeleteboard', true, array(
'en' => 'Can delete the full board',
'de' => 'Kann komplettes Forum l�schen',
));
$mybb->removeadminpermission('candeleteboard');