[TYPO3] Extension "comments" notification without the need to approve each comment?
Dmitry Dulepov [typo3]
dmitry at typo3.org
Mon Sep 22 12:51:21 CEST 2008
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.
--
Dmitry Dulepov
TYPO3 Core team
My TYPO3 book: http://www.packtpub.com/typo3-extension-development/book
In the blog: http://typo3bloke.net/post-details/tag_your_typo3_extension_releases_in_svn/
More information about the TYPO3-english
mailing list