[TYPO3] Extension "comments" notification without the need to approve each comment?
Thomas Hirt
info at thomas-hirt.at
Tue Sep 30 20:27:01 CEST 2008
Hi!
I am at the moment trying to write my first extension.
Obviously I have some Problem:
Why this line isn't working:
$toEmail = $this->conf['spamProtect.']['notificationEmail'];
I know that this array comes out of the extension comments.
I use a hook inside of this extension.
Where can I get the content of the array
conf['spamProtect.']['notificationEmail']?
Any help apreciated,
Thomas
<?php
require_once(PATH_tslib . 'class.tslib_pibase.php');
class tx_commentsemail_hooks extends tslib_pibase {
function hookFunc(&$params, &$pObj) {
$commentUri = $_SERVER['SCRIPT_URI'];
$commentFirstName = $params['record']['firstname'];
$commentLastName = $params['record']['lastname'];
$commentEmail = $params['record']['email'];
$commentLocation = $params['record']['location'];
$commentHomepage = $params['record']['homepage'];
$commentContent = $params['record']['content'];
$commentRemoteAddr = $params['record']['remote_addr'];
$toEmail = $this->conf['spamProtect.']['notificationEmail'];
echo $toEmail;
}
}
?>
Thomas Hirt schrieb:
> Hi!
> It works! Yipiiiiiiiieeee...
>
> You where right Dmitry, it was the naming convention.
>
> now:
>
> ext_localconf.php in my extension:
> <?php
> $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['comments']['processSubmission'][$_EXTKEY]
> =
> 'EXT:comments_email/class.tx_commentsemail_hooks.php:tx_commentsemail_hooks->hookFunc';
>
> ?>
>
> class.tx_commentsemail_hooks.php
> <?php
> class tx_commentsemail_hooks {
> function hookFunc() {
> // the hard way to see if it is called ;)
> exit('I am called!');
> }
> }
> ?>
>
> Next step for me:
>
> > sending an email with the url of the new comment and the basic
> information (name, comment,...) out of a template.
>
> > great would be a switch:
> if aproval is checked --> no second email because it is sent anyway
> if approuval is not checked --> email from my function
>
> > Write a liitle how to in german...
>
> > Reading Dmitrys book ;)
>
> I'll try if I can do this!
>
> Biiiiiig thanks,
> Thomas
>
> PS: When will your book be ready for delivery?
>
>
>
>
> Dmitry Dulepov [typo3] schrieb:
>> Hi!
>>
>> Thomas Hirt wrote:
>>> 4) I added the file class.comments_email.php in the root folder of my
>>> own extension with the following code:
>>
>> Class names must follow certain naming conventions. Looks how comments
>> does it: tx_comments_.... Do the same: tx_commentsemail_hooks, not
>> comments_email! TYPO3 is very strict about naming conventions, it will
>> simply ignore your class if you do not follow them! You need to start
>> from tx_, then extension key without underscores, then underscore,
>> then something else.
>>
>>> The ext_localconf.php is definitly not included.
>>
>> Why do you think so?
>>
>>> Sorry that it takes soooooo long until I get it,
>>
>> It is not long :) My first extension took three months to write. Now I
>> sometimes create several extensions per day.
>>
More information about the TYPO3-english
mailing list