Skip Navigation

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

Problem:
The client is experiencing an issue where users with custom roles are unable to edit specific posts/pages that were translated by another user. They have tried using the Custom Role Editor plugin and creating custom roles programmatically, but the issue persists. They have also tried using code from the WPML forums to enable the editor role to translate, but it only works for default WordPress roles, not custom ones.

Solution:
We recommend updating to the latest version of WPML, as this issue should be resolved in version 4.6.9. Before updating, ensure to have a complete backup of your site. You can find more information about this issue on our errata page:

If this solution does not seem relevant to your situation, please open a new support ticket with us for further assistance: Contact WPML Support

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.

This topic contains 7 replies, has 2 voices.

Last updated by Mateus Getulio 8 months, 2 weeks ago.

Assisted by: Mateus Getulio.

Author Posts
November 7, 2023 at 8:59 am #14744859

mikeG-21

Hi.

I already wrote you about this problem, but now I am writing you again as I have more informations.

Problem is that users with custom roles can't edit some specific posts/pages that were translated by another user, this is the error they see: hidden link

We are using Custom Role Editor plugin, it worked a while ago but probably with some WPML updates it stopped working.

We tried everything you suggested, I even created Custom Roles programatically, while keeping that plugin deactivated. I also created another admin role programatically but with a different naming, but we got the same problem.

I noticed that we can overcome this on existing WP roles with this code provided on your forums:

//ENABLE EDITOR ROLE TO TRANSLATE
add_filter('wpml_user_can_translate', function ($user_can_translate, $user) {
   if (in_array('editor', (array) $user->roles, true) && current_user_can('translate')) {
      return true;
   }

   return $user_can_translate;
}, 10, 2);

But what we find out, this will only work on existing roles that are available in default WP but not on other custom roles, either created programatically or via plugin.

All of those users are also added as translation managers and have all language pairs selected.

Can you help us?

November 7, 2023 at 9:16 pm #14751745

Mateus Getulio
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hi there,

Thanks for your contact!

We had a recent report for this issue, and we've already found a workaround. I have explained it a bit more in this reply: https://wpml.org/forums/topic/you-dont-have-the-rights-to-translate-from-nl-to-es/#post-14738667

Could you please give it a try and tell us if it helps in your case?

Looking forward to your reply. Thank you.

Regards,
Mateus.

November 8, 2023 at 9:22 am #14754315

mikeG-21

Hi Mateus.

Thank you, this solution worked! The only thing that stands out is that until (if you decide so) this is fixed in future updates, we would need to edit that plugin file (user.php) each time WPML is updated, correct?

Kind Regards
Domen

November 8, 2023 at 6:40 pm #14760529

Mateus Getulio
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello Domen,

Thanks for your reply.

You're correct, it would be necessary to re-add/update the code in the future WPML versions. However, as I have already explained in the mentioned ticket, we're considering to implement this feature - but first we would need to know a bit more the needs of the custom roles you're creating and using.

Just as a formality, and in order to proceed with the feature request, may I kindly ask you to tell us a bit more about the exact reasons for a custom role in your case?

From WPML 4.6.7 the editor role now has the capability to edit all translation which was possible only with admin roles before this WPML version. So perhaps this could be a solution.

Please let me know about the first question, and if the 'Editor' role would be sufficient in this case.

Looking forward to your reply. Thank you.

November 9, 2023 at 10:13 am #14764321

mikeG-21

Hi.

We understand.

We have a highly customized website with a lot of users and therefore we need many custom roles to assign different capabilities per user. It's important for us that only specific user roles can manage the translations.

Let me know if you have any other questions.

November 9, 2023 at 4:14 pm #14769931

Mateus Getulio
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hi Domen,

Thanks for the clarifications.

I have escalated this ticket to our 2nd tier of support where our 2nd tier specialists will take a deeper look at this issue and will try to find a solution.

I will get back to you as soon as I get an answer from them.

Best regards,
Mateus

November 24, 2023 at 8:31 pm #14920837

Mateus Getulio
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello and thank you for your patience.

The issue has been reported already and it is currently being worked on.

I will set the current ticket status to "Escalated to WPML developers team" and I will get back to you as soon as I get any feedback from them.

Kind regards,
Mateus

January 19, 2024 at 12:47 pm #15204967

Mateus Getulio
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello there,

For your information, this issue should be fixed in our latest version (4.6.9). Errata page: https://wpml.org/errata/wpml-custom-role-based-on-the-editor-role-cannot-edit-translations-and-behave-as-editor/

Just make sure to have a complete backup, and kindly update WPML. Thank you.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.