/** * * @param array $data * @return bool */ public function queueNotify($type, $data) { if (!isset($data['actor'])) { $user = \CODOF\User\User::get(); $data["actor"] = array("username" => $user->username, "id" => $user->id, "role" => \CODOF\User\User::getRoleName($user->rid), "avatar" => $user->rawAvatar); } //Insert notification data JSON encoded $nid = \DB::table(PREFIX . 'codo_notify_text')->insertGetId(array("data" => json_encode($data))); //queue notification $qry = "INSERT INTO " . PREFIX . "codo_notify_queue (type, nid) " . " VALUES(:type, :nid)"; $stmt = $this->db->prepare($qry); $created = $stmt->execute(array("type" => $type, "nid" => $nid)); $cron = new \CODOF\Cron\Cron(); $cron->setOnce('notify', 0); return $created; }