Open
Reported for: WPML Multilingual CMS 4.5.9
Overview of the issue
Non-admin users, such as editors or custom roles, experience a 403 Forbidden error in the browser console when accessing certain WPML functionality related to the Advanced Translation Editor (ATE) jobs synchronization. This error is evident when inspecting the console tab in browser developer tools.
Keep in mind that this issue won’t affect your site or its translations, you can continue using WPML and translating your website.
Workaround
Please, make sure of having a full backup of your site before proceeding.
- Open …/wp-content/plugins/sitepress-multilingual-cms/classes/ATE/Loader.php file.
- Replace:
Hooks::onAction( 'wp_loaded' ) ->then( [ self::class, 'getData' ] ) ->then( $maybeLoadStatusBarAndATEConsole ) ->then( Resources::enqueueApp( 'ate-jobs-sync' ) ) ->then( Fns::always( make( WPML_TM_Scripts_Factory::class ) ) ) ->then( invoke( 'localize_script' )->with( 'wpml-ate-jobs-sync-ui' ) );
- With:
if (current_user_can('translate') || current_user_can('manage_options') || current_user_can('manage_translations')) { Hooks::onAction( 'wp_loaded' ) ->then( [ self::class, 'getData' ] ) ->then( $maybeLoadStatusBarAndATEConsole ) ->then( Resources::enqueueApp( 'ate-jobs-sync' ) ) ->then( Fns::always( make( WPML_TM_Scripts_Factory::class ) ) ) ->then( invoke( 'localize_script' )->with( 'wpml-ate-jobs-sync-ui' ) ); }