From 69897b4c66e22607162ba8a1ae8c95c8f616f03a Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 30 Jan 2010 16:20:44 -0800 Subject: Fix the valid_admin code -- it was considering all non-admins invalid. Fixes ticket #997 (highest prime under 1000!) --- modules/user/models/user.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'modules') 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"); } } -- cgit v1.2.3