Hello,
I am encountering an issue with external user registration using PHP. When the "Enable email confirmation" option is enabled, I receive the following error:
An exception occurred: [LogicException] Template email:user_email_confirmation did not render to anything. It must provide either a text or HTML body. in community/src/XF/Mail/Mailer.php on line 174
However, if I disable this option, the user registration process completes successfully. Is this an issue with my code, or could it be a bug?
Although it gives this error, the user is successfully registered.
Here is my code:
Thank you for your assistance.
Best regards
I am encountering an issue with external user registration using PHP. When the "Enable email confirmation" option is enabled, I receive the following error:
An exception occurred: [LogicException] Template email:user_email_confirmation did not render to anything. It must provide either a text or HTML body. in community/src/XF/Mail/Mailer.php on line 174
- XF\Mail\Mailer->renderMailTemplate() in community/src/XF/Mail/Mail.php at line 420
- XF\Mail\Mail->renderTemplate() in community/src/XF/Mail/Mail.php at line 492
- XF\Mail\Mail->getSendableEmail() in community/src/XF/Mail/Mail.php at line 568
- XF\Mail\Mail->send() in community/src/XF/Service/User/AbstractConfirmationService.php at line 89
- XF\Service\User\AbstractConfirmationService->sendConfirmationEmail() in community/src/XF/Service/User/AbstractConfirmationService.php at line 67
- XF\Service\User\AbstractConfirmationService->triggerConfirmation() in community/src/XF/Service/User/RegistrationService.php at line 417
- XF\Service\User\RegistrationService->sendRegistrationContact() in community/src/XF/Service/User/RegistrationService.php at line 339
- XF\Service\User\RegistrationService->_save() in community/src/XF/Service/ValidateAndSavableTrait.php at line 42
- XF\Service\User\RegistrationService->save() in devs/register.php at line 16
However, if I disable this option, the user registration process completes successfully. Is this an issue with my code, or could it be a bug?
Although it gives this error, the user is successfully registered.
Here is my code:
PHP:
<?php
define('XF_ROOT', dirname(__DIR__));
require_once(XF_ROOT . '/community/src/XF.php');
XF::start(XF_ROOT);
$app = XF::setupApp('XF\Pub\App');
$app->start();
$registration = $app->service('XF:User\Registration');
$input['username'] = "xx";
$input['email'] = "xxx@gmail.com";
$input['password'] = "xxxx";
$registration->setFromInput($input);
$user = $registration->save();
print_r($user);
Thank you for your assistance.
Best regards