You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If for whatever reason activation emails won't send successfully (e.g. a misconfigured Email setting), any selected checkboxes on the Permissions tab are cleared, which can cause issues if the user is then saved without reloading the page or reselecting the desired permissions.
In my case I'm actually using Yii DI containers to add a simple conditional to the sendActivationEmail method on the Users service:
publicfunctionsendActivationEmail(User$user): bool
{
$url = $this->getActivationUrl($user);
// Prevent activation email from being sent if user conditions are not metif ($user->isInGroup('clients') && !$user->accountManager->one() && !$user->tier->one())
{
returnfalse;
}
return Craft::$app->getMailer()
->composeFromKey('account_activation', ['link' => Template::raw($url)])
->setTo($user)
->send();
}
So that's why the activation emails are erroring out for me, but the same should be true in any case where the Mailer failed to successfully send, with perhaps one of the biggest potential reason being misconfigured email settings.
Steps to reproduce
Add a new or "Pending" user to a group or customize individual permissions, and make sure it's saved.
Prevent the activation email from being sent successfully, either by returning false from the sendActivationEmail method or by intentionally misconfiguring the email settings.
Click "Send activation email" from the sidebar, and you should get the "Couldn’t send activation email. Check your email settings." flash message.
Inspect the Permissions tab and notice all the permissions are unchecked.
Additional info
Craft version: Craft Pro 4.4.3
PHP version: 8.1.16
Database driver & version: MySQL 8.0.27
The text was updated successfully, but these errors were encountered:
Description
If for whatever reason activation emails won't send successfully (e.g. a misconfigured Email setting), any selected checkboxes on the Permissions tab are cleared, which can cause issues if the user is then saved without reloading the page or reselecting the desired permissions.
In my case I'm actually using Yii DI containers to add a simple conditional to the
sendActivationEmail
method on the Users service:So that's why the activation emails are erroring out for me, but the same should be true in any case where the Mailer failed to successfully send, with perhaps one of the biggest potential reason being misconfigured email settings.
Steps to reproduce
false
from thesendActivationEmail
method or by intentionally misconfiguring the email settings.Additional info
The text was updated successfully, but these errors were encountered: