Перейти к содержимому


Фотография
- - - - -

Уведомление об одобрении объекта


Лучший Ответ Cheren-dow , 28 October 2014 - 12:05

An1hony , доброго времени суток. Из полученного материала можно получить id приложения следующим образом

$item->application_id; 

Ну и кусок кода 

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();
		}

Можно заменить на

if ($state) {
	$item = $this->table->get($id);
	if ($item->application_id == 11) { //	указать 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();
	}
}
Перейти к сообщению


  • Закрытая тема Тема закрыта
В теме одно сообщение

#1 An1hony

An1hony

Отправлено 28 October 2014 - 00:13

В продолжение этой темы.

 

Как сделать так, чтобы уведомление приходило только при одобрении материала в одном определенном приложении, а в других - не приходило?

 

Screenshot_1.jpg


  • 0

#2 Cheren-dow

Cheren-dow

Отправлено 28 October 2014 - 12:05   Лучший Ответ

An1hony , доброго времени суток. Из полученного материала можно получить id приложения следующим образом

$item->application_id; 

Ну и кусок кода 

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();
		}

Можно заменить на

if ($state) {
	$item = $this->table->get($id);
	if ($item->application_id == 11) { //	указать 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();
	}
}

  • 0
Изображение
 




Click to return to top of page in style!