protected function _postInsert() { // Increment user post count $table = Engine_Api::_()->getItemTable('forum_signature'); $select = $table->select()->where('user_id = ?', $this->user_id)->limit(1); // Update user post count $row = $table->fetchRow($select); if (null === $row) { $row = $table->createRow(); $row->user_id = $this->user_id; $row->post_count = 0; } $row->post_count = new Zend_Db_Expr('post_count + 1'); $row->save(); // Update topic post count $topic = $this->getParent(); $topic->post_count = new Zend_Db_Expr('post_count + 1'); $topic->modified_date = $this->creation_date; $topic->lastpost_id = $this->post_id; $topic->lastposter_id = $this->user_id; $topic->save(); // Update forum post count $forum = $topic->getParent(); $forum->post_count = new Zend_Db_Expr('post_count + 1'); $forum->modified_date = $this->creation_date; $forum->lastpost_id = $this->post_id; $forum->lastposter_id = $this->user_id; $forum->save(); parent::_postInsert(); }
public function _postInsert() { parent::_postInsert(); // Create auth stuff $context = Engine_Api::_()->authorization()->context; $context->setAllowed($this, 'everyone', 'view', true); $context->setAllowed($this, 'registered', 'comment', true); $viewer = Engine_Api::_()->user()->getViewer(); }
protected function _postInsert() { if ($this->_disableHooks) { return; } // Update topic $table = Engine_Api::_()->getDbtable('topics', 'advgroup'); $select = $table->select()->where('topic_id = ?', $this->topic_id)->limit(1); $topic = $table->fetchRow($select); $topic->lastpost_id = $this->post_id; $topic->lastposter_id = $this->user_id; $topic->modified_date = date('Y-m-d H:i:s'); $topic->post_count++; $topic->save(); parent::_postInsert(); }
protected function _postInsert() { if ($this->_disableHooks) { return; } parent::_postInsert(); // Create auth stuff $context = Engine_Api::_()->authorization()->context; foreach (array('everyone', 'registered', 'member') as $role) { $context->setAllowed($this, $role, 'view', true); } }
protected function _postInsert() { parent::_postInsert(); // Create auth stuff $context = $this->api()->authorization()->context; // View $view_options = (array) Engine_Api::_()->authorization()->getAdapter('levels')->getAllowed('user', $this, 'auth_view'); if (empty($view_options) || !is_array($view_options)) { $view_options = array('member', 'network', 'registered', 'everyone'); } foreach ($view_options as $role) { $context->setAllowed($this, $role, 'view', true); } // Comment $comment_options = (array) Engine_Api::_()->authorization()->getAdapter('levels')->getAllowed('user', $this, 'auth_comment'); if (empty($comment_options) || !is_array($comment_options)) { $comment_options = array('member', 'network', 'registered', 'everyone'); } foreach ($comment_options as $role) { $context->setAllowed($this, $role, 'comment', true); } }
protected function _postInsert() { // Update product $product = $this->getProduct(); $product->setFromArray($this->getProductParams()); $product->save(); parent::_postInsert(); }
protected function _postInsert() { $table = Engine_Api::_() -> getDbTable('signatures', 'ynvideo'); $select = $table -> select() -> where('user_id = ?', $this -> owner_id) -> limit(1); $row = $table -> fetchRow($select); if (null == $row) { $row = $table -> createRow(); $row -> user_id = $this -> owner_id; $row -> video_count = 1; } else { $row -> video_count = new Zend_Db_Expr('video_count + 1'); } $row -> save(); parent::_postInsert(); }
protected function _postInsert() { parent::_postInsert(); // Update sku $this->_updateSku(); }