Resolved
Reported for: WPML Multilingual CMS 4.6.8
Resolved in: WPML 4.6.9
Overview of the issue
If you have an user with ‘Custom Role’, for example ‘Shop manager’ based on ‘Editor’ role they will not be able edit existing translations.
Workaround
1. In wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/wp/classes/User.php at line 217, change the method – WPMLLIBWPUser::isEditor to:
public static function isEditor(WP_User $user = null) { $capability = "editor"; $capability = apply_filters('wpml_editor_capability', $capability ); return self::hasCap( $capability, $user ); }
2. In theme functions.php add this code:
add_filter('wpml_editor_capability', 'my_editor'); function my_editor(){ $user = wp_get_current_user(); if (in_array('second_custom_role', (array)$user->roles, true)){ return 'second_custom_role'; } }
Change second_custom_role part with your custom role name, in this example shop_manager.