I have a problem with account creation spam, in which a bot or other bad actor tries to create accounts using somebody elses email address. The owner of the email address flags the verification email as spam, and I get tagged by my email provider for sending spam.

I'd like to try a "shadow ban" sort of situation, in which it appears the account creation is successful, but the verification email is not sent and the account is not created.

According to Cancel user creation from hook_user_presave hook_user_presave() won't work.

I thought about using hook_mail_alter() to cancel the verification emails, and then hook_user_insert() to immediately delete the user (or maybe save the user ids, for a cron job to delete later). This seems like it could work, but I'm learning Drupal as I go, so I'm hoping somebody with more experience will be able to think of something simpler.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.