Лучший Ответ Cheren-dow , 23 July 2014 - 12:23
Starlight, доброго времени суток. Сделал для вас решение. Откройте следующий файл
сайт\administrator\components\com_zoo\controllers\item.php
Найдите метод
protected function _editState($state) {
...
}
Внутри метода найдите строку
$this->table->get($id)->setState($state, true);
И после нее вставьте следующий код
if ($state) {
$item = $this->table->get($id);
$mailer = JFactory::getMailer();
$user = JFactory::getUser($item->created_by);
$config = JFactory::getConfig();
$sender = array($config->get('mailfrom'), $config->get('fromname'));
$mailer->setSender($sender);
$mailer->addRecipient($user->email);
$body = $user->name . ', ваш объект «' . $item->name . '» одобрен. Теперь вы можете увидеть его в списках на сайте.';
$mailer->setSubject('Your subject string');
$mailer->setBody($body);
$send = $mailer->Send();
}
Теперь при публикации должны приходить уведомления на почту.
Полный, измененный метод
protected function _editState($state) {
// check for request forgeries
$this->app->session->checkToken() or jexit('Invalid Token');
// init vars
$cid = $this->app->request->get('cid', 'array', array());
if (count($cid) < 1) {
$this->app->error->raiseError(500, JText::_('Select an item to edit publish state'));
}
try {
// update item state
foreach ($cid as $id) {
$this->table->get($id)->setState($state, true);
if ($state) {
$item = $this->table->get($id);
$mailer = JFactory::getMailer();
$user = JFactory::getUser($item->created_by);
$config = JFactory::getConfig();
$sender = array($config->get('mailfrom'), $config->get('fromname'));
$mailer->setSender($sender);
$mailer->addRecipient($user->email);
$body = $user->name . ', ваш объект «' . $item->name . '» одобрен. Теперь вы можете увидеть его в списках на сайте.';
$mailer->setSubject('Your subject string');
$mailer->setBody($body);
$send = $mailer->Send();
}
}
} catch (AppException $e) {
// raise notice on exception
$this->app->error->raiseNotice(0, JText::_('Error editing Item Published State').' ('.$e.')');
}
$this->setRedirect($this->baseurl);
}
Перейти к сообщению


Тема закрыта








