• Resolved JP3

    (@jp3)


    I was playing around with themes after enabling this plugin and found that it broke my site.

    The error shown:

    Fatal error: Cannot redeclare tgmpa() (previously declared in /public_html/wp-content/plugins/buddyforms-members/includes/resources/tgm/class-tgm-plugin-activation.php:2178) in /public_html/wp-content/themes/_any_theme_name_/template-parts/class-tgm-plugin-activation.php on line 1927

    It does this repeatedly with most themes I played with, so the issue is not theme-specific, but plugin-specific, and specifically with declaring tgmpa.

    The temp fix is rename the buddyforms_members folder to disable it and the site comes back. I’m keeping it disabled until I’m done messing with themes, but it should probably be adressed.

Viewing 3 replies - 1 through 3 (of 3 total)
  • @jp3 This is not an issue with this plugin, but with the themes you are trying out.

    A lot of theme repositories demand only one text-domain for translations and theme developers appear to make a habit of doing a lazy search-and-replace in the TGMPA file. Unfortunately, they very often do this incorrectly and break the TGMPA add-on because of that, which is the cause of the error you are seeing.

    Please advise the theme developers to use the Custom TGMPA Generator to get themselves a customized version of TGMPA which will have the search/replace done correctly.

    In the mean time, here’s a straight-forward solution for the next time you come across this issue:
    * Download the TGMPA add-on (just click on the “zipfile” link below the form on the download page: https://tgmpluginactivation.com/download/ )
    * If you see that error, replace the /public_html/wp-content/themes/_any_theme_name_/template-parts/class-tgm-plugin-activation.php file with the class-tgm-plugin-activation.php file from the downloaded zip.

    No other action needed, all should be working fine again after the drop-in replacement.

    Thread Starter JP3

    (@jp3)

    Thank you for taking the time to explain that. I’ll notify the authors of some of the more popular/common themes, but I think it’s a much bigger problem for the WP developers to tackle. Almost every theme I tried kicked out this error.

    @jp3 Yup: the bigger problem is plugin dependency management missing in WP Core, which is the gap TGMPA fills and why such a large number of themes nowadays use it.

    If someone would find me a sponsor, I’d happily solve this, but it’s too big a job to do without having financial sponsor(s).

    In the mean time the Custom Download Generator has been online since three, four years, which at least prevents the kind of issue you were running into.

    I don’t know why the themes you tried haven’t used it. Could it be that they’re quite old ?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Cannot Activate/Deactivate Themes’ is closed to new replies.