Free Captcha plugin for Mautic 6 with support for Google reCAPTCHA, hCaptcha and Cloudflare Turnstile

A good captcha solution is essential for anyone using Mautic forms. The current plugins had outdated code and limited options. That’s why we’ve been working on a new captcha plugin. The first version is now on Github.

Good to know:

  • The plugin is free.
  • Support for Google reCAPTCHA, hCaptcha and Cloudflare Turnstile!
  • This plugin only works with Mautic 6. So it’s ready for the future, but you’ll have to wait a bit longer to use it in production.

Thank you to everyone who worked on older captcha plugins. And thanks to my colleague Roel who did almost all the work.

Read more about the plugin on the Github page:

I would love it if you leave a message in this topic if you use the plugin.

4 Likes

Really nice thank you.
Do you think it would work on M5 ?

I was hoping it would work on Mautic 5 too. But unfortunately it doesn’t.

Hello Richard!

Thank you for making the Mautic community better with your fantastic contribution by sharing this plugin totally free. It will certainly help a lot of people - definitely a must-have! :smiley:

Since many Mautic users are often hesitant to upgrade and continue using older versions, having a compatible version for Mautic 5 would be extremely valuable. If you’re able to adapt it, the whole community would benefit - but of course, that’s entirely up to you!

Thanks once again,
Ricardo

After consulting with my colleague we have decided not to provide support for Mautic 5. But if anyone wants to contribute we will follow up pull requests.

1 Like

Good news! With limited support, the plugin is now also working with Mautic 5! It has been tested with Mautic 5.2.4.

Download the free captcha plugin for Mautic 5 and 6 on Github: GitHub - FireMultimedia/mautic-multi-captcha-bundle: This plugin brings Google's reCAPTCHA, hCaptcha, and Cloudflare Turnstile integration to Mautic 6.

2 Likes

Thank you so much @richardnl !
I’m gonna test it asap!

thanks for the plugin, I followed all the instruccions, but when use it, it appear this message in Mautic logs.

[2025-06-08T01:32:40.731744+00:00] mautic.CRITICAL: Uncaught PHP Exception Doctrine\ORM\ORMInvalidArgumentException: “A new entity was found through the relationship ‘Mautic\FormBundle\Entity\Submission#lead’ that was not configured to cascade persist operations for entity: Mautic\LeadBundle\Entity\Lead with ID #0. To solve this issue: Either explicitly call EntityManager#persist() on this unknown entity or configure cascade persist this association in the mapping for example @ManyToOne(..,cascade={“persist”}).” at /var/www/html/mautic.opin-x.com/public_html/vendor/doctrine/orm/src/ORMInvalidArgumentException.php line 103 {“exception”:“[object] (Doctrine\ORM\ORMInvalidArgumentException(code: 0): A new entity was found through the relationship ‘Mautic\FormBundle\Entity\Submission#lead’ that was not configured to cascade persist operations for entity: Mautic\LeadBundle\Entity\Lead with ID #0. To solve this issue: Either explicitly call EntityManager#persist() on this unknown entity or configure cascade persist this association in the mapping for example @ManyToOne(..,cascade={"persist"}). at /var/www/html/mautic.opin-x.com/public_html/vendor/doctrine/orm/src/ORMInvalidArgumentException.php:103)”} {“hostname”:“ip-172-31-28-116”,“pid”:1897}

Y solo ocurre cuando el plugin esta activo y agrego alguno de los captchas al formulario

We have not seen this error message before. We have tested the plugin extensively on 5.2. 4 and 6.0. What version are you on?

Do you have another captcha plugin? Maybe this one is causing a conflict.

We are experiencing the same error. We’ve tried hCaptcha and Turnstile options. Oddly the Google ReCaptcha plugin doesn’t show up in the Plugins section.

We’re using Mautic 6.0.2

[2025-06-11T12:42:32.373549+00:00] mautic.CRITICAL: Uncaught PHP Exception Doctrine\ORM\ORMInvalidArgumentException: “A new entity was found through the relationship ‘Mautic\FormBundle\Entity\Submission#lead’ that was not configured to cascade persist operations for entity: Mautic\LeadBundle\Entity\Lead with ID #0. To solve this issue: Either explicitly call EntityManager#persist() on this unknown entity or configure cascade persist this association in the mapping for example @ManyToOne(..,cascade={“persist”}).” at /path/to/mautic/vendor/doctrine/orm/src/ORMInvalidArgumentException.php line 103 {“exception”:“[object] (Doctrine\ORM\ORMInvalidArgumentException(code: 0): A new entity was found through the relationship ‘Mautic\FormBundle\Entity\Submission#lead’ that was not configured to cascade persist operations for entity: Mautic\LeadBundle\Entity\Lead with ID #0. To solve this issue: Either explicitly call EntityManager#persist() on this unknown entity or configure cascade persist this association in the mapping for example @ManyToOne(..,cascade={"persist"}). at /path/to/mautic/vendor/doctrine/orm/src/ORMInvalidArgumentException.php:103)”} {“hostname”:“mauticserver”,“pid”:2532531}

Confirming it works in Mautic 5.x

Do you have another captcha plugin active or used before? I think this cause the issue with Google ReCaptcha not show up in the plugins section.

It looks like you used a different reCAPTCHA plugin in the past, and there are still leftover traces of it in the database. That old plugin needs to be fully removed first.

My advice would be to delete everything from the plugins table that contains “captcha” in the name, and then refresh the plugins. We had a similar issue with our demo installation of Mautic 5, and this approach worked for us.

You can run the following SQL query to clean it up:

REMOVE FROM `plugins` WHERE `id` IN (SELECT `id` FROM `plugins` WHERE `name` LIKE '%captcha%');
2 Likes

Thanks Richard. Although there were no plugins in the plugins/ directory, there was a single entry in the plugins table for the recaptcha plugin.

Deleting this row fixed the problem.

Appreciate your help on this, and thank you to you and team for the updated plugin which is functioning well now for us.

Sorry @richardnl I was mistaken. It only works for leads that are not new.

When I remove the section of code below the captcha check in onFormValidation() it works.

I’m not sure why a post save delete exists in that function as it only runs when the form passes validation.

(this section

        $this->eventDispatcher->addListener(LeadEvents::LEAD_POST_SAVE, function (LeadEvent $event) {
            if ($event->isNew()) {
                $this->leadModel->deleteEntity($event->getLead());
            }
        }, -255);

)