Opened 6 months ago
#3600 new defect (bug)
(WPML + BBPress) Recent topics widget not translatable
Reported by: | diegootgs | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | General | Keywords: | |
Cc: |
Description
Hi there, this is Diego from the WPML Compatibility team.
I would like to report a new issue with BBPress.
Steps to Reproduce
- Setup WP with two languages and BBPress
- Create a forum, a topic and translate them
- Place the "Recent topics" widget inside the footer and try to translate it
- Note that the recent topics widgets are not displayed in second language.
Debug
For building the widgets, BBPress is using 'post_parent' => $settingsparent_forum?, in its WP_Query query. As values, receives 'any' or an array of numerical ID's (post ID's).
However, checking the WP_Query handbook: post_parent (int) – use page id to return only child pages. Set to 0 to return only top-level entries.
I don't see the possibility of using a string or 'any' and WPML can't recognises it. It seems like something intended by the author. For example, you can see that they forces this value in other instances:
// Force to any
if ( ! empty( $instance['parent_forum'] ) && ! is_numeric( $instance['parent_forum'] ) ) {
$instance['parent_forum'] = 'any';
}
Workaround
Option 1:
- Edit the widget.
- Look for the "Parent Forum ID" field and leave it empty instead of using
'any'
.
Option 2:
Open .../wp-content/plugins/bbpress/includes/common/widgets.php fie.
Look for line 678:
$settings = $this->parse_settings( $instance );
Just after, add this code:
//workaround compsupp-7407 if ( class_exists('Sitepress') && $settings['parent_forum'] === 'any' ) { $settings['parent_forum'] = ''; }