Stuart Roe
Forum Replies Created
-
Ok, I’ve done some further digging.
This is what is happening on my installation:
It appears that WPML compares the language associated with the requested URL against the language of the home URL (normally http://www.site_name.com). If the languages differ, then the language suffix is installed onto the url, so the URL becomes http://www.site_name.com/de.
Now, to the gallery’s Bootstrap.route method. The get_base_url call gets the home url after it’s been cooked by WPML filtering and the subsequent processing results in a path parameter for those URLs that have the language suffix applied by WPML, resulting in the setting of the router’s context.
Now on to the A_WordPress_Routing_App.passthru method. This method uses the router’ get_request_uri method to update $_SERVER[‘REQUEST_URI’], but the get_request_uri method uses the context property to remove the language from the original url.
Following all of the above, WP tries to build the query for the now cooked $_SERVER[‘REQUEST_URI’] value, but the language is no longer present, so WPML uses the default language, which is the incorrect language for the page. So the query fails – 404 – page not found.
Commenting the following line out in the method Mixin_Router.get_request_uri($with_params = TRUE)
$retval = preg_replace('#^' . preg_quote($this->object->context, '#') . '#', '', $retval);appears to correct the displaying of the gallery. *** I haven’t tested any of the other functions of the gallery. ***
Done. A report has been filed.
Ok, I think that I have managed to identify what is going on. There appears to be a problem with (nextgen-gallery\products\photocrati_nextgen\modules\wordpress_routing)\A_WordPress_Routing_App.passthru method.
I suspect that the method it isn’t create the correct URL. It appears that the language specifier in the URL is being dropped. This results in the WPML module having to guess the language (site default). In my case, the resulting page look up doesn’t locate the page as the language is wrong (the default language is the wrong language).
If you adjust the code in C_NextGEN_Bootstrap.route to report $_SERVER[ ‘REQUEST_URI’ ] either side of the $router->passthru(); method call you can see that $_SERVER[ ‘REQUEST_URI’ ] gets updated to an URL with the language prefix missing. My code currently reads:
error_log('C_NextGEN_Bootstrap.route:pass: ' . print_r($_SERVER[ 'REQUEST_URI' ],TRUE)); $abcdefg_res = $router->passthru(); error_log('C_NextGEN_Bootstrap.route:pass: ' . print_r($_SERVER[ 'REQUEST_URI' ],TRUE)); return $abcdefg_res;Not certain if this will fix the problem, but it should result in the WordPress query finding the appropriate page, so the 404 shouldn’t occur.
Can you suggest a starting point for debugging this? Like where in the nextgen code is the processing of the URL suffix. I can add a trap there to make sure that the code is being triggered.
Hi Cais,
Yes the problem still occurs if the shortcode is replaced with the code created by Add Gallery button.
The German page is currently displaying the ‘Add Gallery’ version of the page.
As requested, here is the English and here is the German version of the album list.
Try accessing the first gallery, 2016 WEC Nürburgring Sunday. The English version of the album view works, the contents of the album are displayed. The German version of the album doesn’t work, it reports that the page can’t be found.