in2code-de / femanager

Modern TYPO3 Frontend User RegistrationTYPO3 Frontend User Registration and Management based on Extbase and Fluid and on TYPO3 8 and the possibility to extend it to your needs. Extension basicly works like sr_feuser_register
https://www.in2code.de/agentur/typo3-extensions/femanager/
46 stars 115 forks source link

Resend confimration from Backend causes Error #335

Open bh-teufels opened 3 years ago

bh-teufels commented 3 years ago

use the resend confirmation function in the Backend Module Causes the following error

Core: Exception handler (WEB): Uncaught TYPO3 Exception: #1476107295: PHP Warning: Creating default object from empty value in /app/web/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php line 700 | TYPO3\CMS\Core\Error\Exception thrown in file /app/web/typo3/sysext/core/Classes/Error/ErrorHandler.php in line 130. Requested URL: http://development.localhost/typo3/index.php?route=%%2Fmodule%%2Fweb%%2FFemanagerM1&token=--AnonymizedToken--&id=3&tx_femanager_web_femanagerm1%%5BuserIdentifier%%5D=13&tx_femanager_web_femanagerm1%%5Baction%%5D=resendUserConfirmationRequest&tx_femanager_web_femanagerm1%%5Bcontroller%%5D=UserBackend

Typo3: 10.4.13 PHP 7.4 femanager: 6.1.2

and is it possible to resend confirmation to all users in the list with one click? -> would you suggest to make a scheduler task that fetches all the users from the DB and calls the resendUserConfirmationRequestAction from the UserBackendController?

MaxGTR commented 3 years ago

Problem comes from method "isMailEnabled" in "public/typo3conf/ext/femanager/Classes/Domain/Service/SendMailService.php". Error with method "cObjGetSingle" from sysext/frontend (TS parsing). If you remove this call mail is sent but with backend URL in links.

bh-teufels commented 3 years ago

if ($this->contentObject->cObjGetSingle($typoScript['embedImage'], $typoScript['embedImage.'])) { [...] } if ($this->contentObject->cObjGetSingle($typoScript['receiver.']['email'], $typoScript['receiver.']['email.']){ [...] } in "public/typo3conf/ext/femanager/Classes/Domain/Service/SendMailService.php" also causes this Error

seems that every call inside "public/typo3conf/ext/femanager/Classes/Domain/Service/SendMailService.php" $this->contentObject->cObjGetSingle causes this Error

bh-teufels commented 3 years ago

if i remove all $this->contentObject->cObjGetSingle Calls the mail is send but like MaxGTR said with BackendURL Links and with click on these neither confirm nor delete ist working.

will his be fixed? Can i generate the confirmation & delete Link on other ways an build my own mail?

bh-teufels commented 3 years ago

Is there any Solution for this Problem? i need to resend confirmation mail to 1000 fe users using a task wich checks the not confirmed yet and wanted to using the sendCreateUserConfirmationMail() Function from \In2code\Femanager\Controller\UserBackendController

bh-teufels commented 3 years ago

Problem ist that ContentObjectRenderer -> cObjGetSingle need TypoScriptFrontendController but is not initalized so both ( $this->typoScriptFrontendController AND $GLOBALS['TSFE']) are NULL

/**
 * @return \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController
 */
protected function getTypoScriptFrontendController()
{
    return $this->typoScriptFrontendController ?: $GLOBALS['TSFE'];
}
bh-teufels commented 3 years ago

seems to be same issue cause as https://github.com/in2code-de/luxletter/issues/45

bh-teufels commented 3 years ago

With the "help" from https://github.com/jweiland-net/luxletter_extended i got it that i could send confirmation or invitation mails from a task but the link (f:link.action) is build with route=%2Fmodule%2Fsystem%2FtxschedulerM1 and end up in the BE > Scheduler (from where the action was called / the mail was send)

how could the target be replaced to the actual wanted page uid? put pageUID in f:link.action does not work

Invitation.html-Template:

boettner-it commented 3 years ago

You may try this untested example:

use TYPO3\CMS\Core\Site\SiteFinder;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\CMS\Extbase\Service\ExtensionService;

$site = GeneralUtility::makeInstance(SiteFinder::class)->getSiteByPageId($pageUid);
$extensionService = GeneralUtility::makeInstancet(ExtensionService::class);
$argumentsPrefix = $extensionService->getPluginNamespace($extensionName, $pluginName);
$arguments = [
    $argumentsPrefix => [
      'action' => $actionName,
      'controller' => $controllerName,
      'foo' => 1,
    ],
];
$uri = (string)$site->getRouter()->generateUri((string)$pageUid, $arguments);
bh-teufels commented 3 years ago

@boettner-it Thank you very much that worked for me