This is a brief post on how to fix type E_PARSE error on Lingotek Version 1.4.3 on WordPress 5.2.2.
We had a call from a client who had been struggling to use the Lingotek plugin (with Polylang) on WordPress and wasn’t making any headway.
We asked for a description of the problem, how to replicate it and their wordpress & server login which they gave.
We got the the page on the plugin indicated and clicked the “Connect Your Account” button and were met with the following page:
This caused an error mail to be sent containing the following error:
Error Details ============= An error of type E_PARSE was caused in line 578 of the file /home/websitename/public_html/wp-content/plugins/lingotek-translation/include/api.php. Error message: syntax error, unexpected '->' (T_OBJECT_OPERATOR), expecting ']'
This immediately pointed out the cause of the error!
We immediately logged into to the file manager and opened the api.php file in
Scrolling down to Line 578 was the following line
$this->log_error_on_response_failure($response, "DeleteTranslation: Error occurred", ['id' -> $id, 'wordpress_id' => $wp_id]);
At the point,
'id' -> $id,
we simply changed the code to
'id' => $id,
and saved the api.php file.
Going back to the wordpress Admin, we once again tried connecting the plugin and it immediately redirected to the page to create a Lingotek account.
So simply, that’s how to fix type E_PARSE error on Lingotek Version 1.4.3 which would not allow the website owner connect their wordpress website to lingotek.
The current version of Lingotek on the wordpress repository is 1.4.3 which was updated recently and they have been informed of this issue. Hopefully they update soon with a fix.
Peter (Target ICT).