탐색 건너뛰기

Open

Reported for: BuddyPress Multilingual 1.7.0

Topic Tags: Compatibility

Overview of the issue

In BuddyBoss, when discussions are translated, the translated versions may not have the correct forum assignment and might not display within the forum loop. This issue can lead to translated discussions not appearing under the corresponding translated forums on the frontend.

Workaround

Please, make sure of having a full backup of your site before proceeding.

  • Go to WPML > Settings > Custom XML Configuration page.
  • Add the following XML:
    <wpml-config>
      <custom-fields>
        <custom-field action="copy-once">_bbp_forum_id</custom-field>
        <custom-field action="copy-once">_bbp_last_active_time</custom-field>
        <custom-field action="copy-once">_bbp_activity_id</custom-field>
        <custom-field action="copy-once">_bbp_author_ip</custom-field>
        <custom-field action="copy-once">	_bbp_reply_count</custom-field>
        <custom-field action="copy-once">_bbp_reply_count_hidden</custom-field>
        <custom-field action="copy-once">_bbp_topic_id</custom-field>
        <custom-field action="copy-once">_bbp_voice_count</custom-field>
      </custom-fields>
    </wpml-config>
    
  • Open your theme’s functions.php file.
  • Add the following PHP code:
    // WPMl Workaround for compsupp-7242
    function wpml_compsupp7242_filter_bbp_get_topic_forum_id($forum_id, $topic_id) {
        if ( class_exists('Sitepress') ) {
            $forum_id = apply_filters('wpml_object_id', $forum_id, get_post_type($forum_id), TRUE);
        }
    
        return $forum_id;
    }
    
    add_filter('bbp_get_topic_forum_id', 'wpml_compsupp7242_filter_bbp_get_topic_forum_id', 10, 2);
    
    // I'm not sure if this other filter is really needed, but I'm also adding here for reference
    function wpml_compsupp7242_filter_bbp_get_forum_id($bbp_forum_id, $forum_id) {
        if ( class_exists('Sitepress') ) {
            $bbp_forum_id = apply_filters('wpml_object_id', $bbp_forum_id, get_post_type($bbp_forum_id), TRUE);
        }
    
        return $bbp_forum_id;
    }
    
    add_filter('bbp_get_forum_id', 'wpml_compsupp7242_filter_bbp_get_forum_id', 10, 2);
    
  • Do a small modification on the original discussion and save it.
  • Update its translation

답장을 남겨주세요

주제를 유지하고 다른 사람을 존중하십시오. 이 게시물과 관련 없는 문제에 대한 도움이 필요한 경우 지원 포럼을 사용하여 채팅을 시작하거나 티켓을 제출하십시오.

다음 태그를 사용할 수 있습니다.
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>