/** * This method is executed when someone sends a comment. * * @param string $context * @param UserIdeasTableItem $row * @param boolean $isNew * * @return null|boolean */ public function onCommentAfterSave($context, $row, $isNew) { $app = JFactory::getApplication(); /** @var $app JApplicationSite */ if ($app->isAdmin()) { return null; } if (strcmp('com_userideas.comment', $context) !== 0) { return null; } $emailId = (int) $this->params->get('post_comment_email_id', 0); // Check for enabled option for sending mail // when user sends a comment. if ($emailId > 0 and ($isNew and $row->id > 0)) { $item = new Userideas\Item\Item(JFactory::getDbo()); $item->load($row->get('item_id')); $success = $this->sendMail($emailId, $item->getTitle(), $item->getSlug(), $item->getCategorySlug()); if (!$success) { return false; } } return true; }