Title: Stuart Roe's Replies | WordPress.org

---

# Stuart Roe

  [  ](https://wordpress.org/support/users/5sidecube/)

 *   [Profile](https://wordpress.org/support/users/5sidecube/)
 *   [Topics Started](https://wordpress.org/support/users/5sidecube/topics/)
 *   [Replies Created](https://wordpress.org/support/users/5sidecube/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/5sidecube/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/5sidecube/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/5sidecube/engagements/)
 *   [Favorites](https://wordpress.org/support/users/5sidecube/favorites/)

 Search replies:

## Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Photo Gallery, Sliders, Proofing and Themes - NextGEN Gallery] Album link 404's on secondary WPML language](https://wordpress.org/support/topic/album-link-404s-on-secondary-wpml-language/)
 *  Thread Starter [Stuart Roe](https://wordpress.org/support/users/5sidecube/)
 * (@5sidecube)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/album-link-404s-on-secondary-wpml-language/#post-8230570)
 * 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](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](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. \*\*\***
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Photo Gallery, Sliders, Proofing and Themes - NextGEN Gallery] Album link 404's on secondary WPML language](https://wordpress.org/support/topic/album-link-404s-on-secondary-wpml-language/)
 *  Thread Starter [Stuart Roe](https://wordpress.org/support/users/5sidecube/)
 * (@5sidecube)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/album-link-404s-on-secondary-wpml-language/#post-8221978)
 * Done. A report has been filed.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Photo Gallery, Sliders, Proofing and Themes - NextGEN Gallery] Album link 404's on secondary WPML language](https://wordpress.org/support/topic/album-link-404s-on-secondary-wpml-language/)
 *  Thread Starter [Stuart Roe](https://wordpress.org/support/users/5sidecube/)
 * (@5sidecube)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/album-link-404s-on-secondary-wpml-language/#post-8215029)
 * 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.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Photo Gallery, Sliders, Proofing and Themes - NextGEN Gallery] Album link 404's on secondary WPML language](https://wordpress.org/support/topic/album-link-404s-on-secondary-wpml-language/)
 *  Thread Starter [Stuart Roe](https://wordpress.org/support/users/5sidecube/)
 * (@5sidecube)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/album-link-404s-on-secondary-wpml-language/#post-7694461)
 * 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.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Photo Gallery, Sliders, Proofing and Themes - NextGEN Gallery] Album link 404's on secondary WPML language](https://wordpress.org/support/topic/album-link-404s-on-secondary-wpml-language/)
 *  Thread Starter [Stuart Roe](https://wordpress.org/support/users/5sidecube/)
 * (@5sidecube)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/album-link-404s-on-secondary-wpml-language/#post-7694453)
 * 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.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Photo Gallery, Sliders, Proofing and Themes - NextGEN Gallery] Album link 404's on secondary WPML language](https://wordpress.org/support/topic/album-link-404s-on-secondary-wpml-language/)
 *  Thread Starter [Stuart Roe](https://wordpress.org/support/users/5sidecube/)
 * (@5sidecube)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/album-link-404s-on-secondary-wpml-language/#post-7694400)
 * As requested, [here is the English](http://www.racingbytmg.com/en/wec/wec-photo-gallery/)
   and [here is the German](http://www.racingbytmg.com/de/home-de/wec-de/wec-photo-gallery-de/)
   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.

Viewing 6 replies - 1 through 6 (of 6 total)