Skip to:
Content
Pages
Categories
Search
Top
Bottom

Issue with Polylang


  • xxreef
    Participant

    @xxreef

    Hi all,
    first thanks for this plugin.

    I have a problem on Polylang, a widget to manage the site in multilanguage, the base features are all supported, but when in the secondary “italian” language I click on “modifica” (Edit) the page response with 404.

    The Polylang works with the introduction of /it/ url after the domain and before the rest of uri.

    This problem don’t exist on main English language.

    Bye Renzo

    The page I need help with: https://www.mischianti.org/it/forums/

Viewing 18 replies - 1 through 18 (of 18 total)

  • ecollart
    Participant

    @ecollart

    Same problem for me, also using Polylang !

    If the admin bar is visible on top, the Edit menu from there brings you in the backend and you can edit the topic.
    The link is http://domain.com/wp-admin/post.php?post=9050&action=edit

    But the Edit menu from the Subject (admin links) give a 404 error
    The link here is http://domain.com/fr/forums/topic/admin-gui/edit/

    Very frustrating especially that the top admin bar is not visible for regular forum participants.

    Thanks for your help

    Eric Collart


    Robin W
    Moderator

    @robin-w

    so I’m presuming that

    http://domain.com/forums/topic/admin-gui/edit/

    would work ie it is the ‘/fr’ that is the problem ?


    Robin W
    Moderator

    @robin-w

    and have you added topic, reply and forum as custom post types in the polylang settings


    xxreef
    Participant

    @xxreef

    Hi,
    in polylang settings the url is set to change with language, bbpress work for all situation (topic post reply) but the edit and other link in the upper bar not work.

    polylang settings

    this is the default configuration for polylang.

    With the flag “Hide URL language information for default language” allow to work for the default language (not use /en/).

    I try to add a rewrite rule to htaccess without success.
    https://stackoverflow.com/questions/70142230/why-my-additional-rewrite-rule-is-ignored

    Bye Renzo


    ecollart
    Participant

    @ecollart

    Hello Robin,

    Thanks a lot for your help

    In my case, all forums, topics, responses and keywords are checked in Polylang settings.

    Removing the /fr doesn’t solve the problem.

    Eric


    Robin W
    Moderator

    @robin-w

    so typing for instance

    http://domain.com/forums/topic/admin-gui/edit/

    in the url does not work either?


    Robin W
    Moderator

    @robin-w

    and are you on ploylang pro?

    I can see in settings options for ‘share slugs’ and ‘translate slugs’ that might be needed (or might not be!) and need the pro version.

    and have you raised this issue with polylang ?


    xxreef
    Participant

    @xxreef

    Hi robin,
    in my situation for the default language
    http://domain.com/forums/topic/admin-gui/edit/
    work with flag “Hide URL language information for default language”,

    but for the others language the rewrite rule is triggered for edit, and add /it/, and 404 is raised.

    Bye Renzo


    ecollart
    Participant

    @ecollart

    Hello Robin,

    I raised the issue with Polylang today as well but no answer yet from there.
    I am not using the PRO version.

    The http://domain.com/forums/topic/admin-gui/edit/ doesn’t work at all for me but I didn’t try hiding URL language information for the default language.

    The problem looks consistent.

    Eric Collart


    Robin W
    Moderator

    @robin-w

    ok, as I’m not running polylang I can’t really help further.

    I have no doubt it can be fixed, but not by me 🙂

    But I cannot see that anyone else has had issues with this – not saying that it does work for others, just that I cannot find anyone reporting that they have had issues.


    xxreef
    Participant

    @xxreef


    Robin W
    Moderator

    @robin-w

    it looks like the ‘free’ version does not have support – few threads are answered – that is of course the plugin authors choice, but suspect you might need to upgrade to pro to get help on this.


    xxreef
    Participant

    @xxreef

    Mmmm.. It is a little scam, I believe that the features we need are hidden as support for REST calls

    Polylang scam feature

    I think the only solution is to change htaccess file with a rewrite rule to bypass the add of language in the url.

    Bye Renzo


    xxreef
    Participant

    @xxreef

    Hi again,
    I did some progress.

    With this code

    function filter_pll_check_canonical_url( $redirect_url, $language ) {
        if(strpos($redirect_url, '/edit/') !== false && strpos($redirect_url, '/forums/') !== false && strpos($redirect_url, '/reply/') !== false) {
            $redirect_url = str_replace('/it/', '/', $redirect_url);
            $redirect_url = str_replace('/en/', '/', $redirect_url);
        }
        return $redirect_url;
    }
    add_filter( 'pll_check_canonical_url', 'filter_pll_check_canonical_url', 10, 2 );

    reply works correctly, but if I remove the “reply” filter I had an issue with topics, the forum ID of the Italian language is not present on the selection in editor.

    The solution can be not to use “pretty” edit links like

    http://localhost:82/it/forums/topic/moved-reply-to-prova-manipolazione-url/edit/

    but the link in a query string, like when the topic isn’t approved.

    http://localhost:82/it/?post_type=topic&p=18604&topic=moved-reply-to-prova-manipolazione-url&edit=1&view=all

    there is a way to enable this kind of link as default for edit and the other topic action?

    Thanks Renzo


    xxreef
    Participant

    @xxreef

    I finally fixed my forum with another workaround.
    I change template.php in topics folder, from
    // Pretty permalinks, previously usedbbp_use_pretty_urls()`
    // https://bbpress.trac.wordpress.org/ticket/3054
    if ( false === strpos( $topic_link, ‘?’ ) ) {
    $url = trailingslashit( $topic_link ) . bbp_get_edit_slug();
    $url = user_trailingslashit( $url );

    // Unpretty permalinks
    } else {
    $url = add_query_arg( array(
    bbp_get_topic_post_type() => $topic->post_name,
    bbp_get_edit_rewrite_id() => ‘1’
    ), $topic_link );
    }`

    I disable permalinks for edit of the topic when It’s Italian

    // Pretty permalinks, previously usedbbp_use_pretty_urls()`
    // https://bbpress.trac.wordpress.org/ticket/3054
    if ( false === strpos( $topic_link, ‘?’ ) && strpos($topic_link, ‘/it/’) == false ) {
    $url = trailingslashit( $topic_link ) . bbp_get_edit_slug();
    $url = user_trailingslashit( $url );

    // Unpretty permalinks
    } else {
    $url = add_query_arg( array(
    bbp_get_topic_post_type() => $topic->post_name,
    bbp_get_edit_rewrite_id() => ‘1’
    ), $topic_link );
    }`

    I hope this helps.
    You can check the behavior on http://www.mischianti.org

    Bye Renzo


    Robin W
    Moderator

    @robin-w

    thanks for posting this 🙂


    ecollart
    Participant

    @ecollart

    Hello,

    not being programmer, I can’t use this as it is but can this be used to help in my case to restore the edit and delete function from the topic top bar menu when using Polylang (FR and EN) ?

    I am pushing at Polylang free support too but no luck so far … would be good to have Polylang and bbPress to talk together as being 2 big actors in WordPress…

    Sorry if the question seems obvious to you …

    Thanks for your help

    Eric Collart

    Ps: I can provide access to test if useful…


    xxreef
    Participant

    @xxreef

    Hi ecollart,
    you must put in your function.php in your theme folder

    
    function filter_pll_check_canonical_url( $redirect_url, $language ) {
        if(strpos($redirect_url, '/edit/') !== false && strpos($redirect_url, '/forums/') !== false && strpos($redirect_url, '/reply/') !== false) {
            $redirect_url = str_replace('/fr/', '/', $redirect_url);
            $redirect_url = str_replace('/en/', '/', $redirect_url);
        }
        return $redirect_url;
    }
    add_filter( 'pll_check_canonical_url', 'filter_pll_check_canonical_url', 10, 2 );
    

    and you must modify inside the folder topic of your bbpres plugin the file template.php

    from

    
    // Pretty permalinks, previously usedbbp_use_pretty_urls()
    // https://bbpress.trac.wordpress.org/ticket/3054
    if ( false === strpos( $topic_link, ‘?’ ) ) {
    $url = trailingslashit( $topic_link ) . bbp_get_edit_slug();
    $url = user_trailingslashit( $url );
    
    // Unpretty permalinks
    } else {
    $url = add_query_arg( array(
    bbp_get_topic_post_type() => $topic->post_name,
    bbp_get_edit_rewrite_id() => ‘1’
    ), $topic_link );
    }

    to

    
    // Pretty permalinks, previously usedbbp_use_pretty_urls()
    // https://bbpress.trac.wordpress.org/ticket/3054
    if ( false === strpos( $topic_link, ‘?’ ) && strpos($topic_link, ‘/fr/’) == false  && strpos($topic_link, ‘/en/’) == false ) {
    $url = trailingslashit( $topic_link ) . bbp_get_edit_slug();
    $url = user_trailingslashit( $url );
    
    // Unpretty permalinks
    } else {
    $url = add_query_arg( array(
    bbp_get_topic_post_type() => $topic->post_name,
    bbp_get_edit_rewrite_id() => ‘1’
    ), $topic_link );
    }
    
    

    Bye Renzo

Viewing 18 replies - 1 through 18 (of 18 total)
  • You must be logged in to reply to this topic.