Rahmon / woo-for-logged-users

Set WooCommerce pages accessible only for logged-in users
GNU General Public License v2.0
3 stars 1 forks source link

Add option for multi-lingual sites #31

Open damndingo opened 1 year ago

damndingo commented 1 year ago

Hi, is it possible to add options for multi-lingual sites, so you can choose different redirect pages based on the language? Thanks :-D

Rahmon commented 1 year ago

Hi @damndingo

That's a good feature but it requires some investigation to define how to approach it. In the meantime, it's possible to use the filter wflu_redirect_page_url to implement a custom logic based on the language. Example:

add_filter(
    'wflu_redirect_page_url',
    function( $redirect_page_url ) {
        if ( YOUR_CONDITION ) {
            return 'YOUR_CUSTOM_URL'
        }

        return $redirect_page_url;
    }
);

Thanks for contributing.

damndingo commented 1 year ago

Hi Ramon,

Thank you very much for your reply. I am using Polylang Pro on the website and don’t quite know how to set the condition, since it’s not based on the browser language, but on the page where the user comes from.

Best wishes Harald

Am 31.01.2023 um 23:21 schrieb Ramon Ahnert @.***>:

Hi @damndingo https://github.com/damndingo That's a good feature but it requires some investigation to define how to approach it. In the meantime, it's possible to use the filter wflu_redirect_page_url to implement a custom logic based on the language. Example:

add_filter( 'wflu_redirect_page_url', function( $redirect_page_url ) { if ( YOUR_CONDITION ) { return 'YOUR_CUSTOM_URL' }

  return $redirect_page_url;

} ); Thanks for contributing.

— Reply to this email directly, view it on GitHub https://github.com/Rahmon/woo-for-logged-users/issues/31#issuecomment-1411147967, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE6V4DV6HTAZI3Q6BSHPXELWVGF53ANCNFSM6AAAAAAUMWSKV4. You are receiving this because you were mentioned.

Rahmon commented 1 year ago

@damndingo

I've never used Polylang but I'm almost sure that the plugin should have a function to detect the language based on the page or maybe you can just check if the parameter is passed in the URL and access it via $_GET.

I'd suggest you ask for their support about that.