PHP code example of rkw / rkw-registration
1. Go to this page and download the library: Download rkw/rkw-registration library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once ('vendor/autoload.php' );
rkw / rkw-registration example snippets
public function optIn (
\RKW\RkwRegistration\Domain\Model\FrontendUser $frontendUser,
\RKW\RkwRegistration\Domain\Model\OptIn $optIn
) : void {
$settings = $this ->getSettings(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
$settingsDefault = $this ->getSettings();
if ($settings['view' ]['templateRootPaths' ]) {
$mailService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(MailService::class);
$mailService->setTo($frontendUser, array (
'marker' => array (
'frontendUser' => $frontendUser,
'optIn' => $optIn,
'pageUid' => intval($GLOBALS['TSFE' ]->id),
'loginPid' => intval($settingsDefault['loginPid' ]),
),
));
$mailService->getQueueMail()->setSubject(
FrontendLocalizationUtility::translate(
'rkwMailService.optInAlertUser.subject' ,
'rkw_alerts' ,
null ,
$frontendUser->getTxRkwregistrationLanguageKey()
)
);
$mailService->getQueueMail()->addTemplatePaths($settings['view' ]['templateRootPaths' ]);
$mailService->getQueueMail()->addPartialPaths($settings['view' ]['partialRootPaths' ]);
$mailService->getQueueMail()->setPlaintextTemplate('Email/OptInAlertUser' );
$mailService->getQueueMail()->setHtmlTemplate('Email/OptInAlertUser' );
$mailService->send();
}
}
$signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class);
$signalSlotDispatcher->connect(
RKW\RkwRegistration\Registration\AbstractRegistration::class,
RKW\RkwRegistration\Registration\AbstractRegistration::SIGNAL_AFTER_CREATING_OPTIN . 'RkwAlerts' ,
RKW\RkwAlerts\Service\RkwMailService::class,
'optInAlertUser'
);
public function optInAction (string $tokenUser, string $token) : void
{
$registration = $this ->objectManager->get(FrontendUserRegistration::class);
$result = $registration->setFrontendUserToken($tokenUser)
->setCategory('rkwAlerts' )
->setRequest($this ->request)
->validateOptIn($token);
if ($result >= 200 && $result < 300 ) {
} elseif ($result >= 300 && $result < 400 ) {
} else {
}
}
$signalSlotDispatcher->connect(
RKW\RkwRegistration\Registration\AbstractRegistration::class,
\RKW\RkwRegistration\Registration\AbstractRegistration::SIGNAL_AFTER_REGISTRATION_COMPLETED . 'RkwAlerts' ,
'RKW\\RkwAlerts\\Alerts\\AlertManager' ,
'saveAlertByRegistration'
);