[TYPO3-english] Email alerts on update

Mathias Schreiber [wmdb >] mathias.schreiber at wmdb.de
Wed May 27 18:39:16 CEST 2009


Sylvain Gourvil - Mediasmart schrieb:
> Hi all,
> 
> There is something I could not find and I am quite sure it exists 
> somewhere in repository or core.
> 
> I do not want to use workspace. I just want to receive an email when a 
> backend user update a content, create a page ... with user and url in 
> the email content.
> Does anyone know how to implement it ?

Pretty easy.
There is a hook in tcemain that can be called after the data has been 
processed.
Simply send emails then (see example):

function processDatamap_afterDatabaseOperations($status, $table, $id, 
$fieldArray, $that) {
		global $BE_USER;

		$localFieldArray = t3lib_div::_GP('data');
		$localFieldArray = $localFieldArray[$table][$id];
		if ($table == 'tt_news' && 
$localFieldArray['tx_wmdbbitpresseabo_send'] == 1 && 
$localFieldArray['hidden'] == 0) {
			// Hole aktuelle News
			$queryParts = array(
				'SELECT' 	=> 'uid',
				'FROM' 		=> $table,
				'WHERE' 	=> 'datetime = '.$localFieldArray['datetime'].' AND pid = 
'.intval($localFieldArray['pid']).' AND cruser_id = 
'.intval($BE_USER->user['uid']),
				'LIMIT' 	=> 1,
			);
			$res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
			echo $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery;
			$row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);

			$bodytext = 'Eine neue Newsmeldung auf ###SITE###
===========================================================================
'.$localFieldArray['title'].'
===========================================================================
'.strip_tags($localFieldArray['short']).'
===========================================================================
Mehr unter: <###DETAILLINK###>';

		}
	}

-- 
TYPO3 certified intregator
T3DD09 Entertainer


More information about the TYPO3-english mailing list