lloc / Multisite-Language-Switcher

WordPress Plugin: Multisite Language Switcher
http://msls.co
134 stars 41 forks source link

Wrong site URL #39

Closed nlemoine closed 10 years ago

nlemoine commented 11 years ago

Hi,

I'm using thethe_msls() function to ouput the switch language links.

I noticed that it's getting the wrong URL with the directory structure I'm using (WP core files in a subdirectory, see https://github.com/bueltge/WordPress-Starter).

The main blog URL is http://mydomain.com/wp whereas the home of this blog is http://mydomain.com/

This is because the get_current_link function in MslsOptions.php file is taking the site_url function instead of the home_url function.

I think your plugin should use home_url('/')to retrieve the current link.

What do you think ?

lloc commented 11 years ago

Interesting! I will check that. Thanks for the message.

hja64 commented 11 years ago

I have the same problem, is there a way to fix this?

lloc commented 11 years ago

You are using the same approach? You have the WP-core files in a subdirectory?

hja64 commented 11 years ago

Yes I have the WP-core files in a subdirectory. I've already changed the [get_current_link] but that didn't function.

lloc commented 11 years ago

The wrong link url is shown for the current blog if I understood the problem, right? There is - at the moment - no workaround for this special kind of installation.

hja64 commented 11 years ago

Do you expect one in the near future?

lloc commented 11 years ago

Yes - for sure - if there is a solution.

nlemoine commented 11 years ago

Did you try the solution I mentionned ? You just have to replace site_url() by home_url(), that's why these two different functions exists.

Do you me to submit a pull request ?

lloc commented 11 years ago

@nlemoine Before this I want to be sure if this is an issue of the Multisite Language Switcher and not something which comes with the "WordPress in a subdirectory"-approach.

But you can write some tests to help on this. Read on here:

sasselin commented 11 years ago

Here is my fix:

Change line 140 of the MslsOptions.php file:

before: return( '' != $postlink ? $postlink : site_url() );

after: return( '' != $postlink ? $postlink : home_url() );

Voila ;)

lloc commented 11 years ago

@sasselin Please look at the actual developer version here at GitHub: https://github.com/lloc/Multisite-Language-Switcher/commit/19a15eba9d475927f53b321ed8ab129c844e8a69 because this is already in there.

eric-holmes commented 11 years ago

Was just about to report this as well. Posted it onto the WP.org support forum.

Will this be added in the next production version? AKA is it safe to be changing these 2 lines in the plugin myself for now?

lloc commented 11 years ago

Yes, it is already in the code as I said above. ;)