Development > Coding and development discussion

new Admin.php function

(1/1)

Wanuarmi:
Id like to suggest this function added to Admin.php


--- Code: --- function upto_group($name, $group)
{
$name = ucfirst(strtolower($name));
$group = strtolower($group);
$in_group = 0;
$result = $this -> bot -> db -> select("SELECT * FROM admin_members WHERE name = $name");
foreach($result AS $entry) // same user can be in multiple groups
{
if (empty($in_group) || $in_group > $entry[1])
$in_group = $entry[1];
}
$result = $this -> bot -> db -> select("SELECT * FROM admin_groups WHERE name = $group");
if (empty($result))
return false;
if (!empty($in_group) && $in_group <= $result[0][0])
return true;
return false;
}
--- End code ---

so you dont have to check multiple groups for commands, and so admins have all permissions raidleaders have. this would only work if the groups hierarchy was kept in the id column though...

Navigation

[0] Message Index

Go to full version