[TYPO3] Extension "comments" notification without the need to approve each comment?

Thomas Hirt info at thomas-hirt.at
Mon Sep 22 14:00:00 CEST 2008


Thanks,
but my function seems not to be called even after I clear the cache...

in comments/ext_localconf.php
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['comments']['processSubmission'][$_EXTKEY] 
= 
'EXT:toms_extension/class.tx_tomsext_hookclass.php:tx_tomsext_hookclass->testEmail';

in toms_extension/class.tx_tomsext_hookclass.php
<?php
class tx_tomsext_hookclass {	
	function testEmail() {
		debug('I am called!');
	}
}
?>

 >> You do not have pi_getLL in this class. This will result in fatal PHP
 From where do you know this?
Where do I see wich Parameters are available?

I love typo3 but I have really a hard time figuring out where to look 
for arrays and so on.

Anyway,
Thanks




Dmitry Dulepov [typo3] schrieb:
> Hi!
> 
> Thomas Hirt wrote:
>> Not working... I never receive 2 Emails.
>> Even if i say:
>>
>> class tx_tomsext_hookclass {
>>     exit("test");
>> }
> 
> PHP error, you need a function in the class!
> 
>> Grml, I wish I would understand this stuff....
>>
>> @Dmitry: it's very kind of you messing around with questions like this 
>> one...
> 
> Well, I try to help as much as I can...
> 
>> 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'; 
> 
> 
> Looks ok. Do not forget ot clear config cache.
> 
>> 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.
> 
> You should not copy. Why do you need all this complexity? You could just 
> use one line with "debug('I am called!');" there to check if the hook is 
> called at all.
> 
>> <?php
>> class tx_tomsext_hookclass {
>>     function testEmail($uid, $points) {
> 
> Wrong function parameters. Check in the extension manual what should the 
> parameters be. If I remember correctly it is an array $params and 
> tx_comments_pi1 &$pObj.
> 
> <skip>
> 
>>             // 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);
> 
> Remove all the above.
> 
>>             t3lib_div::plainMailEncoded($toEmail, 
>> $this->pi_getLL('email.subject'), $content, 'From: ' . 
>> $this->conf['spamProtect.']['fromEmail']);
> 
> You do not have pi_getLL in this class. This will result in fatal PHP 
> error.
> 


More information about the TYPO3-english mailing list