state == "published") { notification::send_comment_published($comment); } } static function comment_updated($old, $new) { if ($new->state == "published" && $old->state != "published") { notification::send_comment_published($new); } } static function user_before_delete($user) { ORM::factory("subscription") ->where("user_id", $user->id) ->delete_all(); } static function operation($name, $item) { if ($name == "add") { $id = Session::instance()->get("notification_batch_item_id"); if ($id && $item->id != $id) { notification::send_batch_add($id); } Session::instance()->set("notification_batch_item_id", $item->id); } } static function end_operation($name) { if ($name == "add") { $id = Session::instance()->get_once("notification_batch_item_id"); if ($id) { notification::send_batch_add($id); } } } }