Home›Support›English Support›[Feature Request] Problem with Custom Roles not been able to edit secondary languages
[Feature Request] Problem with Custom Roles not been able to edit secondary languages
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:
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.
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?
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.
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.
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.