xxreef (@xxreef)

Forum Replies Created

Viewing 8 replies - 1 through 8 (of 8 total)
  • In reply to: Issue with Polylang

    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

    In reply to: Issue with Polylang

    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

    In reply to: Issue with Polylang

    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

    In reply to: Issue with Polylang

    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

    In reply to: Issue with Polylang

    xxreef
    Participant

    @xxreef

    In reply to: 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

    In reply to: Issue with Polylang

    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


    xxreef
    Participant

    @xxreef

    Sorry you can close this topic, I resolved It by remove lazy load.
    I don’t know why, but the problem become only when BBPress 2.6.7 is active, (i disable It and all works), but If I remove lazy load Works again also with BBPress 2.6.7.

    Thanks Renzo

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