Ejemplo n.º 1
0
 /**
  * This method is executed when someone create an item.
  *
  * @param string             $context
  * @param UserIdeasTableItem $row
  * @param boolean            $isNew
  *
  * @return void|boolean
  */
 public function onContentAfterSave($context, $row, $isNew)
 {
     $app = JFactory::getApplication();
     /** @var $app JApplicationSite */
     if ($app->isAdmin()) {
         return null;
     }
     if (strcmp('com_userideas.form', $context) !== 0) {
         return null;
     }
     $emailId = (int) $this->params->get('send_when_post_email_id', 0);
     // Check for enabled option for sending mail
     // when user create a item.
     if ($emailId > 0 and ($isNew and $row->get('id'))) {
         $success = $this->sendMail($emailId, $row->get('title'), $row->getSlug(), $row->getCategorySlug());
         if (!$success) {
             return false;
         }
     }
     return true;
 }