[TYPO3] Extension "comments" notification without the need to approve each comment?
Thomas Hirt
info at thomas-hirt.at
Mon Sep 22 12:43:30 CEST 2008
Hi!
Did that...
Not working... I never receive 2 Emails.
Even if i say:
class tx_tomsext_hookclass {
exit("test");
}
Grml, I wish I would understand this stuff....
@Dmitry: it's very kind of you messing around with questions like this
one...
What I did:
in ext_localconf.php I placed the following line:
-----------------------------------------------
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['comments']['processSubmission'][$_EXTKEY]
=
'EXT:toms_extension/class.tx_tomsext_hookclass.php:tx_tomsext_hookclass->testEmail';
-----------------------------------------------
then I createted the file class.tx_tomsext_hookclass.php in
ext/toms_extensions
There I copied the following lines (just to try if it would work). I
copied them from the original Extension and they are in charge of
sending the email. I thought this would send a second notification
mail... of course it didn't.
<?php
class tx_tomsext_hookclass {
function testEmail($uid, $points) {
$toEmail = $this->conf['spamProtect.']['notificationEmail'];
$fromEmail = $this->conf['spamProtect.']['fromEmail'];
if (t3lib_div::validEmail($toEmail) &&
t3lib_div::validEmail($fromEmail)) {
$template =
$this->cObj->fileResource($this->conf['spamProtect.']['emailTemplate']);
$check = md5($uid .
$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']);
$markers = array(
'###URL###' => t3lib_div::getIndpEnv('TYPO3_REQUEST_URL'),
'###POINTS###' => $points,
'###FIRSTNAME###' => $this->piVars['firstname'],
'###LASTNAME###' => $this->piVars['lastname'],
'###EMAIL###' => $this->piVars['email'],
'###LOCATION###' => $this->piVars['location'],
'###HOMEPAGE###' => $this->piVars['homepage'],
'###CONTENT###' => $this->piVars['content'],
'###REMOTE_ADDR###' =>
t3lib_div::getIndpEnv('REMOTE_ADDR'),
'###APPROVE_LINK###' =>
t3lib_div::locationHeaderUrl('/index.php?eID=comments&uid=' . $uid .
'&chk=' . $check . '&cmd=approve'),
'###DELETE_LINK###' =>
t3lib_div::locationHeaderUrl('/index.php?eID=comments&uid=' . $uid .
'&chk=' . $check . '&cmd=delete'),
'###KILL_LINK###' =>
t3lib_div::locationHeaderUrl('/index.php?eID=comments&uid=' . $uid .
'&chk=' . $check . '&cmd=kill'),
'###SITE_REL_PATH###' =>
t3lib_extMgm::siteRelPath('comments'),
);
// Call hook for custom markers
if
(is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['comments']['sendNotificationMail']))
{
foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['comments']['sendNotificationMail']
as $userFunc) {
$params = array(
'pObj' => &$this,
'template' => $template,
'check' => $check,
'markers' => $markers,
);
if (is_array($tempMarkers =
t3lib_div::callUserFunction($userFunc, $params, $this))) {
$markers = $tempMarkers;
}
}
}
$content = $this->cObj->substituteMarkerArray($template,
$markers);
t3lib_div::plainMailEncoded($toEmail,
$this->pi_getLL('email.subject'), $content, 'From: ' .
$this->conf['spamProtect.']['fromEmail']);
}
}
}
?>
Could someone give me a hint?
Thanks,
Thomas
Dmitry Dulepov [typo3] schrieb:
> Hi!
>
> Thomas Hirt wrote:
>> in ext_localconf.php I placed the following line:
>> -----------------------------------------------
>> $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['comments']['processSubmission'] =
>
> Add [$_EXTKEY] before "=" ;)
>
More information about the TYPO3-english
mailing list