public function update_readings($new_readings) { global $wpdb; if (!$this->can_save()) { return false; } $old_readings = $this->readings(); $this->revision_num++; $this->revision_id = self::register_revision_num($this->id, $this->revision_num); $this->time_modified = self::save_readings($this->revision_id, $new_readings); $this->reading_count = count($new_readings); // We need to save the plan now because we have updated the revision table // and if we don't save the plan, they might get out of sync $this->save(false); // Update any reading schedule progress for this plan BfoxReadingSchedule::update_schedules_for_plan_id($this->id, $this->revision_id, $old_readings, $new_readings); }