• Resolved ktakahisa

    (@ktakahisa)


    the redirection using wpmem_logout shortcode doesn’t work.

    [wpmem_logout url="http://example.com/some-page/"]

    the shortcode above is on the “Other Shortcodes” page:
    https://rocketgeek.com/plugins/wp-members/docs/shortcodes/other-shortcodes/

    I’m using wp-members with “Polylang” multilingual plugin.
    for example, for english language users, I want to redirect them to english top page like:
    http:example.com/en/

    but the shortcode redirect them to non-language-spacified top page like:
    http:example.com/

    any suggestions?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Chad Butler

    (@cbutlerjr)

    Unfortunately, that appears to be a mistake in the documentation (and the code). Even though that attribute is there, the way that the logout function processes, it will never work. I’ll look into working out a possibility in the future, but for now that method is a no go.

    To redirect on logout, you do need to use the wpmem_logout_redirect filter. Apply a conditional test in your filter function to check for the language (use WP’s get_locale() or Polylang’s pll_current_language() to check the locale) and redirect based on the result.

    Thread Starter ktakahisa

    (@ktakahisa)

    thank you for the advice.
    I was able to switch redirects using the filter.
    I hope the shortcode will work properly in the near future.

    for a reference, the code I used:

    function my_logout_redirect(){
      $current_locale = get_locale();
      if( $current_locale == 'en-US' ):
        $redirect_url = 'http://www.example.com/en-US/';
      else:
        $redirect_url = 'http://www.example.com/';
      endif;
      return $redirect_url;
    }
    add_filter( 'wpmem_logout_redirect', 'my_logout_redirect' );
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘redirection after logout using wpmem_logout shortcode failed’ is closed to new replies.