Skip to content Skip to sidebar

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client reported that editors and shop managers were unable to translate pages or products that were completed by an admin.

Solution:
First, we provided a workaround:
1) Navigate to the

*sitepress-multilingual-cms/vendor/wpml/wp/classes*

folder.
2) Edit the

*User.php*

file.
3) Locate line 217 and replace the existing code with:

public static function isEditor(\WP_User $user = null) {
	$capability = "editor";
	$capability = apply_filters('wpml_editor_capability', $capability );
	return self::hasCap( $capability, $user );
}

4) Edit the

functions.php

file of your theme and add the following code at the bottom:

add_filter('wpml_editor_capability', 'my_editor');
function my_editor(){
    $user = wp_get_current_user();
    if (in_array('shop_manager', (array)$user->roles, true)){
        return 'shop_manager';
    }
}

5) Clear all types of caches.
We emphasized the importance of taking a full site backup before applying this workaround.

Subsequently, we released a new version of WPML (4.6.9 series) that included a fix for this issue. We advised the client to update to the latest version after ensuring a full site backup and check if the problem persists.

If this solution doesn't look relevant to your situation, please open a new support ticket with us.

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.

Tagged: 

This topic contains 10 replies, has 2 voices.

Last updated by Bigul 1 year, 8 months ago.

Assisted by: Bigul.

Author Posts
November 20, 2023 at 1:46 pm #14877593

erwinV-10

Editors can't translate posts anymore

November 21, 2023 at 2:07 pm #14887697

Bigul

Hello,

One request. Please try the following steps and make sure the bug exists or is not on the sandbox site. It will help us a lot in debugging.

1) Click this URL to visit the Sandbox site backend - hidden link
2) Configure the WooCommerce like your live site
3) Configure WPML like your live site and activate WPML add-ons
4) Create a test product and translate it
5) Create a new store manager user
6) Set the user as a Translator and Translation manager

--
Thanks!

Bigul

November 21, 2023 at 2:58 pm #14888261

erwinV-10

Hi, I just created the Sandbox site and did what you asked.
A shop manager can't edit translated pages or products.
(But I can't add a Translation Manager. I don't know if it's a sandbox thing. I can add Translation Manager on my site.)

November 22, 2023 at 7:13 am #14893011

Bigul

Hello,

Thank you for reproducing the issue on the sandbox site. We will debug it further and get back to you as early as possible. Please wait.

--
Thanks!

Bigul

November 24, 2023 at 10:15 am #14915795

Bigul

Hello,

We are still working on this issue. Now consulting with our second-tier team for an expert opinion. We will get back to you as soon as possible. Please wait.

--
Thanks!

Bigul

November 27, 2023 at 4:15 pm #14932621

erwinV-10

OK. Thanks for looking into it. I'll wait further.

November 28, 2023 at 7:55 am #14936359

Bigul

Hello,

The ticket is escalated to our second-tier team for further debugging. We will get back to you as early as possible. Please wait.

--
Thanks!

Bigul

December 6, 2023 at 12:53 pm #15007729

Bigul

Hello,

We are getting the expected results in the Sandbox site after the following steps. Please check it and let us know your feedback.

1) Go to *sitepress-multilingual-cms/vendor/wpml/wp/classes* folder
2) Open *User.php* file for editing
3) Scroll down to line 217
4) Make the following changes and save it

From

public static function isEditor(\WP_User $user = null) {
	return self::hasCap( 'editor', $user );
}

To

public static function isEditor(\WP_User $user = null) {
	$capability = "editor";
	$capability = apply_filters('wpml_editor_capability', $capability );
	return self::hasCap( $capability, $user );
}

5) Open functions.php file of your theme for editing
6) Scroll down to bottom of the file, add the following code and save it

add_filter('wpml_editor_capability', 'my_editor');
function my_editor(){
    $user = wp_get_current_user();
    if (in_array('shop_manager', (array)$user->roles, true)){
        return 'shop_manager';
    }
}

7) Clear all types of caches

This bug is escalated to our developers for further debugging and fixing. So please try it as workaround on your live site for the time being after a full site backup{mandatory}.

--
Thanks!

Bigul

December 7, 2023 at 10:55 am #15015885

erwinV-10

I added the code to my website.
Now it works. Thanks for this workaround.

I'm waiting for the plugin update to make it permanent.
Thanks.

December 7, 2023 at 7:08 pm #15020513

Bigul

Hello,

Thank you for the feedback. Happy to know you are getting the expected results now. We will get back to you soon when we have a update from our developers on this. Please wait.

--
Thanks!

Bigul

January 19, 2024 at 1:12 pm #15205109

Bigul

Hello,

We have released a new version of WPML(4.6.9 series). It has included the fix for this bug. Please upgrade to the latest version after a full site backup{mandatory} and make sure the bug exists or not.

--
Thanks!

Bigul