summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2010-02-01 21:13:07 -0800
committerBharat Mediratta <bharat@menalto.com>2010-02-01 21:20:05 -0800
commit6030d4eb6540d5c10eb1ab862d81a48420e1ec78 (patch)
treedff5002d3a04c728de57bba124c70b04b76c614e
parente7c564133f6f50c2b14be9b0e2cad162f4531726 (diff)
Fix a bug in valid_name where it wasn't checking for name collisions on new users.
-rw-r--r--modules/user/models/user.php2
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/user/models/user.php b/modules/user/models/user.php
index baac9315..9871ca00 100644
--- a/modules/user/models/user.php
+++ b/modules/user/models/user.php
@@ -122,7 +122,7 @@ class User_Model extends ORM implements User_Definition {
public function valid_name(Validation $v, $field) {
if (db::build()->from("users")
->where("name", "=", $this->name)
- ->where("id", "<>", $this->id)
+ ->merge_where($this->id ? array(array("id", "<>", $this->id)) : null)
->count_records() == 1) {
$v->add_error("name", "conflict");
}