WPML makes the user logged out on 3.1.8.1 upgrade
WPML rolled out an update to their plugin version 3.1.8.1.
But since the update you cannot work in the admin panel any more, each url will have more then one slash in it.
Here is my fix for the problem (until thy will issue an update).
The problem is in the sitepress.class.php file on line 6464, and created by in the addition of line 6463.
In line 6463 they have added a selection of site_url paramtere from the global parameter set of wordpress:
$this->settings[ ‘language_domains’ ][ $default_language ] = $wpdb->get_var( “SELECT option_value FROM $wpdb->options WHERE option_name = ‘siteurl'”);
This selection have an url of the website WITH the trailing slash in it.
And this data is sent to the next line: 6464
$new_url = str_replace( $absolute_home_url, $this->settings[ ‘language_domains’ ][ $code ], $new_url );
What this creates is a URL with next features:http://localhost//wp-admin/?lang=frAnd the double slash created the logout problem.By addint my lines of code, the error can be managed, untill a more permanent fix will be applied by WPML team:Simple add next code between 6463 and 6464 (inclusive)
$this->settings[ ‘language_domains’ ][ $default_language ] = $wpdb->get_var( “SELECT option_value FROM $wpdb->options WHERE option_name = ‘siteurl'”);
$arrUrl = parse_url($absolute_home_url);
if(!isset($arrUrl[‘path’])) $arrUrl[‘path’] = ‘/’;
$absolute_home_url = $arrUrl[‘scheme’].”://”.$arrUrl[‘host’].$arrUrl[‘path’];
if(!isset($arrUrl[‘query’])) $absolute_home_url .= ‘?’.$arrUrl[‘query’];
if(!isset($arrUrl[‘fragment’])) $absolute_home_url .= ‘#’.$arrUrl[‘fragment’];$arrUrl = parse_url($this->settings[ ‘language_domains’ ][ $code ]);
if(!isset($arrUrl[‘path’])) $arrUrl[‘path’] = ‘/’;
$this->settings[ ‘language_domains’ ][ $code ] = $arrUrl[‘scheme’].”://”.$arrUrl[‘host’].$arrUrl[‘path’];
if(!isset($arrUrl[‘query’])) $this->settings[ ‘language_domains’ ][ $code ] .= ‘?’.$arrUrl[‘query’];
if(!isset($arrUrl[‘fragment’])) $this->settings[ ‘language_domains’ ][ $code ] .= ‘#’.$arrUrl[‘fragment’];$new_url = str_replace( $absolute_home_url, $this->settings[ ‘language_domains’ ][ $code ], $new_url );
[…] after my previous post WPML have relised a new version 3.1.8.2, but it looks like this error gone […]
WPML 3.1.8.x and the double slash problems continues. | Alex (SirShurf) Frenkel's Blog
October 28, 2014 at 2:12 pm