Hallo
Ich möchte eine frei definierbare Seite als Ziel für den Link im Bestätigungsmail eingeben.
Folgendes Vorgehen (nach https://community.contao.org/de/show...%E4tigungsmail) ausprobiert, aber leider ohne Erfolg. Müsste doch klappen, oder?
PHP-Code:
//config.php
$GLOBALS['TL_HOOKS']['avisotaActivateSubscribtion'][] = array('MyClass', 'hookAvisotaActivateSubscribtion');
//MyClass.php
class MyClass.php extends ModuleAvisotaSubscription
{
public function __construct()
{
$this->import('DomainLink');
$this->import('FrontendUser', 'User');
}
function hookAvisotaActivateSubscribtion($arrRecipient, $arrTokens)
{
foreach ($_SESSION['avisota_subscription'] as $strMessage)
{
// break on error
if (preg_match('#|error$#', $strMessage))
{
return;
}
}
// remove the messages, alternative show this messages on the confirmation page
unset($_SESSION['avisota_subscription']);
// everythink is allright, redirect to confirmation page
$this->import('Database');
$this->import('Environment');
$this->Environment->request = $this->generateFrontendUrl($this->getPageDetails(71)->row());
}
}
Was ich gemerkt habe: Offenbar wird die Funktion immer über
PHP-Code:
if (preg_match('#|error$#', $strMessage))
{
return;
}
beendet. Auch wenn kein Fehler drin ist.
Lesezeichen