Navigation überspringen

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

Eine Antwort hinterlassen

Please stay on topic and be respectful to others. If you need help with issues not related to this post, use our Support Forum to start a chat or submit a ticket.

Sie können diese Tags verwenden:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>