public function update()
{
$allow = true;
$allow = Plugins::filter('comment_update_allow', $allow, $this);
if (!$allow) {
return false;
}
Plugins::act('comment_update_before', $this);
// invoke plugins for all fields which have been updated
foreach ($this->newfields as $fieldname => $value) {
Plugins::act('comment_update_' . $fieldname, $this, $this->fields[$fieldname], $value);
}
$result = parent::updateRecord(DB::table('comments'), array('id' => $this->id));
$this->fields = array_merge($this->fields, $this->newfields);
$this->newfields = array();
$this->info->commit();
Plugins::act('comment_update_after', $this);
return $result;
}