summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2010-01-30 16:20:44 -0800
committerBharat Mediratta <bharat@menalto.com>2010-01-30 16:20:44 -0800
commit69897b4c66e22607162ba8a1ae8c95c8f616f03a (patch)
treef8c4dde2a2d09f51ca4d766b0929b25a4f306065 /modules
parentdccb2b73ffe205e359eeea57e4c7c52e584eccc5 (diff)
Fix the valid_admin code -- it was considering all non-admins invalid.
Fixes ticket #997 (highest prime under 1000!)
Diffstat (limited to 'modules')
-rw-r--r--modules/user/models/user.php3
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/user/models/user.php b/modules/user/models/user.php
index 0cd634ea..baac9315 100644
--- a/modules/user/models/user.php
+++ b/modules/user/models/user.php
@@ -148,7 +148,8 @@ class User_Model extends ORM implements User_Definition {
* Validate the admin bit.
*/
public function valid_admin(Validation $v, $field) {
- if ($this->id == identity::active_user()->id && !$this->admin) {
+ $active = identity::active_user();
+ if ($this->id == $active->id && $active->admin && !$this->admin) {
$v->add_error("admin", "locked");
}
}