[Resolved] You can only edit translations assigned to you.
This thread is resolved. Here is a description of the problem and solution.
Problem: After updating WPML, users on your site are unable to edit translations. Previously, all users could duplicate posts for translation without restrictions. Users now receive an error message stating 'You can only edit translations assigned to you,' and the button to edit a translation is disabled. Solution: If you're experiencing this issue, we recommend checking the user roles on your site. By default, only admins and translation managers can access any translation, duplicate content, and create translation jobs. Non-admin users must be assigned as translation managers to use the WPML Translation Editor similarly to admins. For more details on setting up a translation manager, visit Setting up a Translation Manager.
Additionally, if a translation job is already assigned to one translator, it cannot be accessed by another unless the assigned translator resigns from the job. For setting up local translators and language pairs, check How to Set Up Local Translators and Language Pairs.
The client added that he has more than 300 users that need to be able to edit the translation and it would be to time demanding to manually assigned each user as translator or translation manager. To allow non-admin users to manage translations without being admins, you can add a custom capability to their user roles. Here's a code snippet you can use:
function wpml_custom_assign_capability() {
$users = get_users();
foreach ($users as $user) {
if (!in_array('subscriber', $user->roles) && !in_array('admin', $user->roles)) {
if (!user_can($user, 'wpml_manage_translation_management')) {
$user->add_cap('wpml_manage_translation_management');
}
}
}
}
add_action('init', 'wpml_custom_assign_capability');
This code will enable the specified users to access WPML > Translation Management and create jobs for themselves, which they can then translate or duplicate.
If this solution does not resolve your issue or seems outdated, 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 further assistance is needed, please open a new support ticket at WPML support forum.
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 am managing a site with over 300 users and after upgrading WPML, users are unable to edit translations. Previously, we wanted a simple setup where all users could duplicate posts for translation without any restrictions on permissions, assignments, or translation pairs.
Symptoms:
Users receive an error message 'You can only edit translations assigned to you.' and the button to edit a translation is disabled.
Questions:
How can I configure WPML so that all users can duplicate posts for translation without needing assignments or translation pairs?
What steps can I take to prevent this issue from recurring after future WPML updates?
Languages: English (English )Spanish (Español )German (Deutsch )
Timezone: America/Lima (GMT-05:00)
Hello,
Which was the last version of WPML running on your site before running the update?
With WPML for at least 5 years or even longer only admins and translation managers can access any translation, duplicate content and create translation jobs for all non-admin users who are assigned as translators.
Users will be by default able to run such tasks if they have an admin user role. Users who are non-admins can get assigned as translation managers and then should be able to use WPML Translation Editor as if they were admins.
Also, if a translation job is already assigned to one translator it would be expected that another translator will not be able to access this job. A translator can resign from a job to make it available for other translators in the translation queue.
Languages: English (English )Spanish (Español )German (Deutsch )
Timezone: America/Lima (GMT-05:00)
We would need to find a programmatical solution in this case.
I will try to find a workaround for this and then reach out to you again.
Please take kindly note, that I am assisting in this case voluntarily, and our supporters are not obligated to provide such custom code solutions and can only support WPML according to its provided options and functionality.
Languages: English (English )Spanish (Español )German (Deutsch )
Timezone: America/Lima (GMT-05:00)
No worries, no fee is necessary 🙂
Please take a backup of your site and database first.
Now, I am not aware which user roles you need to get adjusted, but I created a snippet that will add the capability to manage translations via Translation Management to any user who does not have the admin or subscriber role.
function wpml_custom_assign_capability() {
// Get all users
$users = get_users();
foreach ( $users as $user ) {
// Apply rule only for users that are not admins or subscribers
if ( ! in_array( 'subscriber', $user->roles ) && ! in_array( 'admin', $user->roles ) ) {
// Verify if the capability is already assigned to each user
if ( ! user_can( $user, 'wpml_manage_translation_management' ) ) {
// Assign the capability to each user
$user->add_cap( 'wpml_manage_translation_management' );
}
}
}
}
add_action( 'init', 'wpml_custom_assign_capability' );
This way users can access WPML > Translation Management and create jobs for themselves which they can then translate or duplicate.
There will be no need to assign translator roles or language pairs for those users, as they will be translation managers.
Take note, that those translation managers will not show up inside the list at WPML > Translation Management > Translators, as they were created programmatically.
If you are looking for more functionality let me know, but I am afraid if we give the users similar rights as admin users we might need to add them the manage_options capability and this might not be in your interest.
Thank you Andreas, i think this solved that the user can create new translations, but for some of the existing translations the button is disabled and i get the message "You can only edit translations assigned to you.". May be is another capability that i have to add to the user ?
Thank Andreas, WPML > Translation Management > Jobs is empty and at the right side, there is a message "Jobs could not be loaded" . I uploaded a screenshoot.
Regards.
New threads created by Andreas W. and linked to this one are listed below: