Support » Plugin: MailPoet - emails and newsletters in WordPress » Conflict between Mailpoet and other plugins that use Twig

  • I use Timber (https://github.com/timber/timber) that brings the template engine Twig into WordPress. Now I enabled the Mailpoet plugin and get the error:

    Warning: Cannot declare class Twig_SimpleFunction, because the name is already in use in /var/www/html/wp-content/themes/xyz/vendor/twig/twig/lib/Twig/Function.php on line 130
    
    Warning: Cannot declare class Twig\TwigFunction, because the name is already in use in /var/www/html/wp-content/themes/xyz/vendor/twig/twig/lib/Twig/Function.php on line 132

    Is there an opportunity to solve the conflict and use both plugins together?

    Thanks!

    Best
    Robin

    • This topic was modified 3 years, 2 months ago by Robin.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi @robinchen,

    Are you using the latest version of MailPoet 3?

    Thread Starter Robin

    (@robinchen)

    Yes, I just installed the latest Mailpoet 3 (3.4.4) on a WordPress 4.9.2.

    Jack K

    (@jack-kitterhing)

    Hey Robin,

    Which version of Twig are you using in your Theme? MailPoet does contain code to check for multiple instances of Twig and version compares.

    You can check this out in MailPoet/lib/Config/RequirementsChecker.php, on line number: 158.

    If you could let me know the Twig and also Timber version and I’ll test it out on my install.

    Thanks!

    Thread Starter Robin

    (@robinchen)

    Hi Jack,

    thanks for your help. I’m using the latest Timber (1.7.0) and Twig (2.4.6) and installed Timber via Composer:

    https://timber.github.io/docs/getting-started/setup/

    Thank you!

    Jack K

    (@jack-kitterhing)

    Hi Robin!

    This is interesting. I actually have a Timber based framework which uses Twig, in addition I’ve tried some other Timber based frameworks and can’t actually replicate this even with full error reporting turned on.

    Even though Timber declares Twig_SimpleFunction and so does MailPoet. What’s odd is that your specific warning is coming from the theme.

    Don’t suppose there’s a chance I can have a look at the theme files, or have you got it on Github? I’m sure it’s something simple and I’d love to get this fixed for you. 🙂

    Thanks!

    Thread Starter Robin

    (@robinchen)

    That’s because I installed Timber via Composer into my theme (like mentioned under https://timber.github.io/docs/getting-started/setup/).

    I tested the Timber WP Plugin now. That works fine for me. There are no conflicts anymore.

    • This reply was modified 3 years, 2 months ago by Robin.
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Conflict between Mailpoet and other plugins that use Twig’ is closed to new replies.