Skip to content

Commit

Permalink
Add "developer" role for easy identification
Browse files Browse the repository at this point in the history
(Cannot be set on-site yet; only through user_role.php script)
  • Loading branch information
RedEnchilada committed Jun 12, 2014
1 parent 334ee44 commit ee1438b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
4 changes: 3 additions & 1 deletion classes/Profile_role.php
Expand Up @@ -66,6 +66,7 @@ function pkeyGet($kv)
const OWNER = 'owner';
const MODERATOR = 'moderator';
const ADMINISTRATOR = 'administrator';
const DEVELOPER = 'developer';
const SANDBOXED = 'sandboxed';
const SILENCED = 'silenced';
const DELETED = 'deleted'; // Pending final deletion of notices...
Expand All @@ -76,14 +77,15 @@ public static function isValid($role)
$known = array(self::OWNER,
self::MODERATOR,
self::ADMINISTRATOR,
self::DEVELOPER,
self::SANDBOXED,
self::SILENCED);
return in_array($role, $known);
}

public static function isSettable($role)
{
$allowedRoles = array('administrator', 'moderator');
$allowedRoles = array('administrator', 'moderator', 'developer');
return self::isValid($role) && in_array($role, $allowedRoles);
}
}
5 changes: 5 additions & 0 deletions lib/util.php
Expand Up @@ -487,6 +487,8 @@ function common_current_user()
$user = User::staticGet($id);
if ($user) {
$_cur = $user;
if ($_cur->hasRole(Profile_role::DEVELOPER))
error_reporting(E_ERROR|E_WARNING);
return $_cur;
}
}
Expand All @@ -500,6 +502,9 @@ function common_current_user()
$_SESSION['userid'] = $_cur->id;
}
}

if ($_cur && $_cur->hasRole(Profile_role::DEVELOPER))
error_reporting(E_ERROR|E_WARNING);

return $_cur;
}
Expand Down
12 changes: 10 additions & 2 deletions plugins/Staff/staff.php
Expand Up @@ -28,6 +28,7 @@ function prepare($args)

$this->mods = Profile::adminProfiles(array(Profile_role::MODERATOR));
$this->admins = Profile::adminProfiles(array(Profile_role::ADMINISTRATOR));
$this->devs = Profile::adminProfiles(array(Profile_role::DEVELOPER));
$this->owners = Profile::adminProfiles(array(Profile_role::OWNER));

return true;
Expand Down Expand Up @@ -90,11 +91,18 @@ function showContent()
$admins = new ProfileList($this->admins, $this);
$admins->show();

$this->raw(sprintf('<p style="clear: both;"><b>The Developers of %s</b></p>', $sitename));

$mods = new ProfileList($this->devs, $this);
$mods->show();

$this->raw(sprintf('<p style="clear: both;"><b>The Moderators of %s (Please go to these for basic rule issues)</b></p>', $sitename));

$mods = new ProfileList($this->mods, $this);
$mods->show();


$this->raw("<p>Staff are not accepting new members unless otherwise stated. Do not ask to become a moderator.</p>");
/*
$this->raw(<<<HERE
<p><b>Hoofy information for mods.</b></p>
Expand All @@ -108,7 +116,7 @@ function showContent()
<p><b>V)</b> Directives are sometimes issued by the administrator. You will get either a message on the site, or a direct message.</p>
HERE
);
);*/

}

Expand Down

0 comments on commit ee1438b

Please sign in to comment.