[Resolved] wpml installation on a subside give critical error
This thread is resolved. Here is a description of the problem and solution.
Problem: The client is experiencing a critical error when activating the WPML plugin on a subsite in a WordPress multisite environment. The error occurs after following the standard procedure of installing and activating the plugin network-wide, then on the main site, and finally on the subsite. The error manifests as a blank page displaying 'There has been a critical error on this website' during the final steps of the WPML configuration. Solution: We identified a syntax error and a fatal error in the WPML plugin files through the debug log provided by the client. The errors were related to incorrect HTML tags and a null object reference in the plugin's upgrade script. To resolve this, we recommended modifying the
This modification checks if the 'administrator' role exists before attempting to add capabilities, preventing the error.
If this solution does not resolve the issue or seems irrelevant due to updates or different circumstances, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If problems persist, please open a new support ticket at WPML support forum for further assistance.
This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
Background of the issue:
I already opened a request yesterday and I was chatting but the chat has been closed and I do not know how to find it or re-open so I have to do everything from zero again. As you can see from our account we are using WPML since a while and we already installed it in WP multisite with no issues. This time we are having WP critical error when we activate the plugin in 1 subsite while for another one everything is fine. I followed your documentation and installed first the plugin in the network, then activated in the main site and registered and after that activated in the subsite. When I activate it takes me to the configuration, I do all the steps to configure and when I arrive at the end instead of saving and showing the dashboard it shows a blank page with the WP message: there has been a critical error on this website. If I go back I get to the dashboard but anything I try to do gives error so I had to deactivate WPML to get everything working fine. We have a few plugins in the site: Woocommerce, thumb press, and we use Astra theme. Plugin already used in other sites without any issues or compatibility problems.
If I force the refresh than I can access to the dashboard so I went to WPML/Support and copy here the debug information.
Symptoms:
There has been a critical error on this website.
Questions:
How can I resolve the critical error when activating WPML on a subsite?
Is there a way to find or re-open my previous support chat?
Here attached also the debug.log as the error happen right now when I tried to get the debug info attached above, after refresh it is working but then suddenly it will happen again and again, and this issue go away if I deactivate wpml. We use Astra Theme.
Thank you for contacting WPML support, I’m happy to help you with this issue.
I edit the site in the network area and add the last slash (/) to the site and home URLs then the subsite hidden link is working properly. Can you please confirm it works on your end?
Unfortunately is not as you say. Just go in and try to activate wpml string translations and you will constantly see the error.
We need to sort out this issue ASAP.
Thanks and kind regards
Really I do not know how you can say it was working, I just try to go on pages (without activating strin translation) and I have the same error. It woul dbe nice to have a video of your tests to prove you do not have errors on your end.
Thanks and kind regards
another point: You installed WP File manager without asking first!
You are not authorized to install anything in our sites without asking first, if you need to do it for solving the issue you ask first and after finishing you remove whatever you have added and revert our site as we want.
Also you activated wpml at the network level but who told you that we want to have this plugin activated everywhere?
A bit more professionality would be appreciated.
I normally use the chat to stay with the assistance and know what you do but as your collegue was not able to solve he asked to move to the tiket but please you do not change our sites.
The plugin Should work as usually if not there is a problem in your plugin. The other plugins that are inside are all compatible....
You need to search the issue in your home.
I see the error once when I visit the admin area of the subsite /la/. There is an error in the debug log:
[03-Jul-2024 11:21:21 UTC] PHP Parse error: syntax error, unexpected token "<" in /web/htdocs/www.snsidigitale.com/home/mysnsi_stage/wp-content/plugins/sitepress-multilingual-cms/classes/upgrade/commands/AddTranslationManagerCapToAdmin.php on line 10
I review that file and see there is an HTML <br> tag in the file which isn't correct so I try to re-install the plugin WPML. For now, there is another error in the log:
[05-Jul-2024 08:39:47 UTC] PHP Fatal error: Uncaught Error: Call to a member function add_cap() on null in /web/htdocs/www.snsidigitale.com/home/mysnsi_stage/wp-content/plugins/sitepress-multilingual-cms/classes/upgrade/commands/AddTranslationManagerCapToAdmin.php:10
Stack trace:
#0 /web/htdocs/www.snsidigitale.com/home/mysnsi_stage/wp-content/plugins/sitepress-multilingual-cms/classes/upgrade/class-wpml-upgrade-run-all.php(11): WPML\Upgrade\Commands\AddTranslationManagerCapToAdmin->run()
#1 /web/htdocs/www.snsidigitale.com/home/mysnsi_stage/wp-content/plugins/sitepress-multilingual-cms/classes/upgrade/class-wpml-upgrade.php(159): WPML_Upgrade_Run_All->run_admin()
#2 /web/htdocs/www.snsidigitale.com/home/mysnsi_stage/wp-content/plugins/sitepress-multilingual-cms/classes/upgrade/class-wpml-upgrade.php(147): WPML_Upgrade->maybe_run_admin()
#3 /web/htdocs/www.snsidigitale.com/home/mysnsi_stage/wp-content/plugins/sitepress-multilingual-cms/classes/upgrade/class-wpml-upgrade.php(131): WPML_Upgrade->run_command()
#4 /web/htdocs/www.snsidigitale.com/home/mysnsi_stage/wp-content/plugins/sitepress-multilingual-cms/classes/upgrade/class-wpml-upgrade.php(116): WPML_Upgrade->run_commands()
#5 /web/htdocs/www.snsidigitale.com/home/mysnsi_stage/wp-content/plugins/sitepress-multilingual-cms/classes/upgrade/class-wpml-upgrade.php(80): WPML_Upgrade->run_admin()
#6 /web/htdocs/www.snsidigitale.com/home/mysnsi_stage/wp-content/plugins/sitepress-multilingual-cms/classes/upgrade/class-wpml-upgrade-loader.php(150): WPML_Upgrade->run()
#7 /web/htdocs/www.snsidigitale.com/home/mysnsi_stage/wp-includes/class-wp-hook.php(324): WPML_Upgrade_Loader->wpml_upgrade()
#8 /web/htdocs/www.snsidigitale.com/home/mysnsi_stage/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#9 /web/htdocs/www.snsidigitale.com/home/mysnsi_stage/wp-includes/plugin.php(517): WP_Hook->do_action()
#10 /web/htdocs/www.snsidigitale.com/home/mysnsi_stage/wp-content/plugins/sitepress-multilingual-cms/sitepress.class.php(523): do_action()
#11 /web/htdocs/www.snsidigitale.com/home/mysnsi_stage/wp-includes/class-wp-hook.php(324): SitePress->init()
#12 /web/htdocs/www.snsidigitale.com/home/mysnsi_stage/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#13 /web/htdocs/www.snsidigitale.com/home/mysnsi_stage/wp-includes/plugin.php(517): WP_Hook->do_action()
#14 /web/htdocs/www.snsidigitale.com/home/mysnsi_stage/wp-settings.php(550): do_action()
#15 /web/htdocs/www.snsidigitale.com/home/mysnsi_stage/wp-config.php(115): require_once('...')
#16 /web/htdocs/www.snsidigitale.com/home/mysnsi_stage/wp-load.php(50): require_once('...')
#17 /web/htdocs/www.snsidigitale.com/home/mysnsi_stage/wp-admin/admin.php(34): require_once('...')
#18 /web/htdocs/www.snsidigitale.com/home/mysnsi_stage/wp-admin/index.php(10): require_once('...')
#19 {main}
thrown in /web/htdocs/www.snsidigitale.com/home/mysnsi_stage/wp-content/plugins/sitepress-multilingual-cms/classes/upgrade/commands/AddTranslationManagerCapToAdmin.php on line 10
It goes that the error is still there and I do not think what you says as something to do with the issue as This issue happen on 1 subsite only.
It should be your work to fix the issue or what? do I have to change translation plugin to get our of the issue? It is now many days I asked for assistance, it would be time to fix it or to say you are not able and to pass to a more experienced collegue. What do you mean that I have to go to the old post?
For me nothing!
I will open now a new chat and ask for better assistance, I need this issue is solved today or I will search for another plugin, this means that all my future clients will never use your plugin again!
This is not a free plugin we expect good assistance.
You deactivated all plugins for what? I already did that try several time and there is a point it looks like you do not understand: THIS PROBLEM IS ONLY IN 1 SUBSIDE. Go to the IT subsite and you will see that with all the same things activated there are no issue.
I am waiting for a prompt reply.
Regards
I have completely deleted your plugin and reinstalled and it gives exactly the same error. And I repeat again the error is only in the LA subsite.
If this issue will not be solved somehow today I will change plugin.
I did not apply the change of the post you wanted to refer me so now the plugin is exactly as it is provided by you. no customization, nop changes...
I'm sorry about the experience that you are having. This is an edge case and happens on a subsite only. It has been escalated to our development team to fix this. I will update you here when I have more information.
Regarding the plugins deactivated, I don't deactivate them. My colleague tried that in the chat session to troubleshoot the issue.
If you don't know how to apply the workaround, please share the FTP account. I will help you to do that. Your next reply is set to private to share the info.
❌ IMPORTANT: Please backup your database and website before proceeding ❌
I know how to apply the workaround but we do not need it as I told you I uninstall your plugin and reinstall from zero, nothing has changed.
I will not provide FTP.
The problem is in your code and not in my site if you are not able to solve I know what to do, I am already testing polylang, lucky you are not the only one doing plugin for translations.
Everytime I have an issue with transaltion I never get a proper support from you, time to change.
We endorse that this is an issue with the admin role capabilities and is an edge case. Our 2nd tier support also provided a workaround that you can apply on your site to solve the issue quickly.
If there is a chance, please allow me to help you do that by sharing the FTP account or giving permission to edit the plugin, I will apply the workaround on my end.
Once again, thanks for your patience and co-operation.
ok,I give you only today as extra mile, edit the plugin and let's see if you solve it. When you edit the plugin you send also to me what you have done and where exactly.
Thanks and kind regards