Viewing 7 replies - 1 through 7 (of 7 total)
  • Dragos

    (@dragosvrejiu)

    Hello Gabe,

    It looks like the videos you have shared are no longer available – do you still need help with this issue?

    Also, are you using any plugins that manage the log out?

    Best regards,

    Thread Starter geekayhu

    (@geekayhu)

    Hi there,

    first of all sorry… due to maintenance the drive folders have been reorganized in the meantime, so yes, still do:

    screencast 1:
    https://drive.google.com/file/d/1O8hvwCoFgMYHgSMRzFWHhsp_8nU24bPK/view?usp=sharing

    screencast 2 (GET):
    https://drive.google.com/file/d/1JKRBbqUiSLYVwuezkNL90qrJGgeH9iGS/view?usp=sharing

    As far as “logout plugin”, no we don’t use… just wanted to log out through WooCommerce (account page) simple logout link.

    Thanks, and sorry for the video issue.
    Kind regards
    Gabe

    Dragos

    (@dragosvrejiu)

    Hello Gabe,

    I have tried replicating this issue on my local instance but everything seems to be working as expected.

    Can you try running a conflict test?

    ??*Briefly* disable all other plugins and enable the default Twenty Twenty theme. Please also disable all add-ons. If this fixes the problem, enable everything one by one, checking each time to see when the problem returns.

    Best regards,

    Thread Starter geekayhu

    (@geekayhu)

    Hi,

    I checked the site previously as well, but I don’t know how I must have skipped a plugin called “WPS Hide Login” to hide WP default login (/wp-admin).

    Well, this plugin causes the error msg, but now I don’t know if I should get in touch with that plugin’s support team, or you may be able to suggest a plugin with similar functionality to “hide” wp-admin which works with TP, too?

    Thanks in advance
    Regards
    Gabe

    Dragos

    (@dragosvrejiu)

    Hello Gabe,

    You can eventually exclude that URL, so the language parameter is not added to it.

    Here is the custom code you can use in order to achieve this:

    add_action( 'plugins_loaded', 'trpc_exclude_tp_from_pages', -1 );
    function trpc_exclude_tp_from_pages(){
        $do_not_translate_path = array('contact');
    	$do_not_translate_path = array('home');
    	$do_not_translate_path = array('test-page-page');
    
        foreach ( $do_not_translate_path as $path ){
            if ( !empty($path) && strpos($_SERVER['REQUEST_URI'], untrailingslashit($path)) !== false ){
                add_filter( 'trp_allow_tp_to_run', function(){return false; } );
            }
        }
    }

    Change “home” with the page you want to exclude.

    Install this plugin via FTP (copy it inside wp-content/plugins) or create a zip archive with it and install it via the WordPress plugin upload functionality.

    Please let me know if this fixes the issue.

    Best regards,

    Thread Starter geekayhu

    (@geekayhu)

    Hi there,

    thanks for the code!!! Well, the creation and upload/install was successful, but I could not make it work.

    (As I’m not an IT expert, but) I assume the “do_not_translate_path” lines (you inserted three, “contact/home/test-page”) means that the URLs can be listed line by line, so as many as needed can be added, replacing “contact” and/or “home” etc. with the ones to be non-translated, right(?).

    I tried first with only one, a “main log out button link” (top right in our nav menu)
    both main and “en” folder that TP adds to the URL (first one by one)
    https://www.navita.hu/my-account/customer-logout/?customer-logout=true
    https://www.navita.hu/en/my-account/customer-logout/?customer-logout=true/

    along with the built-in Woocommerce link (which I cannot alter manually):
    https://www.navita.hu/my-account/customer-logout/?_wpnonce=b932cbac16
    https://www.navita.hu/en/my-account/customer-logout/?_wpnonce=b932cbac16

    PS: it was a bit confusing to me as well, as you mention “page” to exclude, however, these are “only” direct links for logout (not literal pages, aren’t they).

    I guess the code number after ?_wpnonce= (in bold) refers to the user itself, so if it is true, in this case, it is useless to have it in a link, as all the users will have different “code numbers”; correct me if I’m wrong, as I’m not that good at .PHP, but when I logged in with a “testuser” /customer/ account, the logout link is different (just to show you the example):

    https://www.navita.hu/en/my-account/customer-logout/?_wpnonce=91c1c09207

    As I mentioned, I tried these (4) lines one by one in the .php, and all at once with no luck (and the Woocommerce link is always changing, anyway, depending on the logged-in user). AND I cannot alter that logout link, as it’s Woocommerce’s built-in logout link.

    If it was only with the admins that would be OK, but “regular” users cannot log out, either. I thought WPS Hide login plugin only redirects admins to the WP backend (altered) login page after logging out, but in this case, it inserts the “hidden” path (geekay) into the URL, which returns with 404.

    So, briefly, I don’t know what to do. Worst case, we have to eliminate WPS Hide login, which we do not want.

    The file now has all the 4 lines, tested first one by one, then all together, no success.

    screenshot:
    https://ibb.co/QDYCKWd

    One more comment, weirdly enough, I cannot even log out if WPS hide login is active from WP itself when 2nd language (EN) is set.

    screencast video:
    https://drive.google.com/file/d/1AcW-yQsvujUPOY5o70Soy5Z5c4KpRY1N/view?usp=sharing

    – at 0:07 just wanted to show you the “simple” logout link, and then tried to log out via WP logout link.

    Any idea?
    Thanks in advance
    Regards
    Gabe

    Thread Starter geekayhu

    (@geekayhu)

    Hi,

    in the meantime I tried sg. else, seen in another TP support page.

    Since WPS Hide login adds a “hidden folder”, I tried to exclude that particular one from translation (“geekay”)
    ______________________________

    add_action( 'plugins_loaded', 'trpc_exclude_tp_from_pages', -1 );
    
    function trpc_exclude_tp_from_pages(){
        
    	$do_not_translate_path = array('geekay');
    
        foreach ( $do_not_translate_path as $path ){
            if ( !empty($path) && strpos($_SERVER['REQUEST_URI'], untrailingslashit($path)) !== false ){
                add_filter( 'trp_allow_tp_to_run', function(){return false; } );
    
    			$link = str_replace("en/", "", $_SERVER['REQUEST_URI']);
    			
    			$_SERVER['REQUEST_URI'] = $link;
    			 
    		}
    	}
    }

    ______________________________
    …which seems to be working with Woocommerce/WP logout link.

    Now, my “only” (LOL) concern is, whether the direct logout link in our nav menu:
    https://www.navita.hu/my-account/customer-logout/?customer-logout=true

    …can be made work, somehow. If it’s the main language (HU), it works, if EN it has a “double” (confirm) log out.

    screencast videos:
    EN – in this version, however, it seems to be working, there is an “extra step” Confirm and log out.

    https://drive.google.com/file/d/1lvDyuniKE14w_yWzHmR6EaaYULCqda2k/view?usp=sharing

    HU – it logs out in one-step (no Confirm and log out)

    https://drive.google.com/file/d/19-Yd7aaQSHwNBPiWD_8HSI7gQXe-hI8N/view?usp=sharing
    _________________
    I do not wanna bother you with this much longer, but do you see a chance to make it work instantly from the EN version, without the “Confirm…” step or…? (shall I leave it this way?)
    PS: if I put this direct logout link back to the .PHP as a 2nd $do_not_translate_path array line, it won’t work (404 error). That’s why I’m asking.

    Thanks
    Regards
    Gabe

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Logout won’t work in 2nd language’ is closed to new replies.