summaryrefslogtreecommitdiff
path: root/modules/user/models
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2010-01-16 00:13:28 -0800
committerBharat Mediratta <bharat@menalto.com>2010-01-16 00:13:28 -0800
commitdcf4b5e71ae8a097f133a06485d60c5fb3400824 (patch)
tree2c1e6d81d91238fa636c4dd4949ccd2bf6856c1b /modules/user/models
parent9f03d36d6ee5358b3081f64fc7ef0b0ae42d97db (diff)
Don't pass MY_ORM::original() to update event handlers, since after
parent::save() it'll be reset. Clone it first. This is an alternate fix for #978.
Diffstat (limited to 'modules/user/models')
-rw-r--r--modules/user/models/group.php4
-rw-r--r--modules/user/models/user.php4
2 files changed, 6 insertions, 2 deletions
diff --git a/modules/user/models/group.php b/modules/user/models/group.php
index 515788a3..10f6f4b3 100644
--- a/modules/user/models/group.php
+++ b/modules/user/models/group.php
@@ -41,11 +41,13 @@ class Group_Model extends ORM implements Group_Definition {
if (!$this->loaded()) {
$created = 1;
}
+
+ $original = clone $this->original();
parent::save();
if (isset($created)) {
module::event("group_created", $this);
} else {
- module::event("group_updated", $this->original(), $this);
+ module::event("group_updated", $original, $this);
}
return $this;
}
diff --git a/modules/user/models/user.php b/modules/user/models/user.php
index 7d5bf413..edba2a2c 100644
--- a/modules/user/models/user.php
+++ b/modules/user/models/user.php
@@ -69,11 +69,13 @@ class User_Model extends ORM implements User_Definition {
if (!$this->loaded()) {
$created = 1;
}
+
+ $original = clone $this->original();
parent::save();
if (isset($created)) {
module::event("user_created", $this);
} else {
- module::event("user_updated", $this->original(), $this);
+ module::event("user_updated", $original, $this);
}
return $this;
}