/** * @param bool $force * * @return bool */ public function store($force = true) { $xoops = Xoops::getInstance(); $isNew = $this->isNew(); if (!$this->publisher->getItemHandler()->insert($this, $force)) { return false; } if ($isNew && $this->getVar('status') == _PUBLISHER_STATUS_PUBLISHED) { // Increment user posts $user_handler = $xoops->getHandlerUser(); $member_handler = $xoops->getHandlerMember(); $poster = $user_handler->get($this->getVar('uid')); if (is_object($poster) && !$poster->isNew()) { $poster->setVar('posts', $poster->getVar('posts') + 1); if (!$member_handler->insertUser($poster, true)) { $this->setErrors('Article created but could not increment user posts.'); return false; } } } return true; }
/** * @param int $cat_id * @param string $status * * @return mixed */ public function itemsCount($cat_id = 0, $status = '') { return $this->publisher->getItemHandler()->getCountsByCat($cat_id, $status); }