• Resolved Alex Cicovic

    (@acicovic)


    Hi there,

    When WPML is installed, it would be nice if the plugin could allow different URLs for each language. Right now it is possible to define only a single (language agnostic) URL for each page.

    This comes in handy in multi-language member areas.

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support mbrsolution

    (@mbrsolution)

    Hi, someone was kind enough to share a solution. Please check the following documentation https://simple-membership-plugin.com/user-submitted-tweaks-simple-membership/.

    Let me know if this helps you.

    Thank you

    Thread Starter Alex Cicovic

    (@acicovic)

    Thanks, didn’t see that as I was searching for ‘WPML’.

    I will look into it and adapt it to my scenario, although this will break with every plugin update.

    Could you ask the developer if we could get some hooks there in order to be able to do this outside the plugin’s code?

    Thanks!

    Thread Starter Alex Cicovic

    (@acicovic)

    It seems that the login URL can be overridden by using the swpm_get_login_link_url hook and for the forgot password URL I can probably change the login view.

    Will investigate and keep you posted.

    Thread Starter Alex Cicovic

    (@acicovic)

    In my case I didn’t need to use the swpm_get_login_link_url hook as I only wanted to have a localized version of the “Forgot Password” URL. WPML provides the wpml_permalink hook to get a permalink in another language but it seems to ignore changes to slugs (although it will redirect to the correct page finally).

    So I copied the login.php view to my child theme, and this is what I did for the reset password link URL:

    
    $password_reset_url = alex_get_translated_page_url( $setting->get_value( 'reset-page-url' ) );
    
    function alex_get_translated_page_url( $source_page_permalink )
    {
        $source_page_id = url_to_postid( $source_page_permalink );
        $translated_page_id = wpml_object_id_filter(
            $source_page_id,
            'page',
            false,
            wpml_get_current_language()
        );
    
        return get_permalink( $translated_page_id );
    }
    
    Plugin Support mbrsolution

    (@mbrsolution)

    Thank you very much for sharing your solution. I am sure this will help other.

    Kind regards

    @mbrsolution

    Please check the following documentation https://simple-membership-plugin.com/user-submitted-tweaks-simple-membership/.

    I navigated to that page and found a code block plus this note:

    Modification of the “get_login_link()” function in the classes/class.swpm-utils-misc.php file.

    I can locate the file in the plugin, but have not idea how to apply this code. Paste it in there, but obviously not delete everything else? How can I use this for? Additionally, how can I use this for an English (base) and Japanese (secondary) setup?

    Thank you!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Multilingual URLs when WPML is installed’ is closed to new replies.