跳过导航

Resolved

Reported for: BuddyPress Multilingual 1.7.0

Resolved in: BuddyPress Multilingual 1.8.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>