Opened 6 years ago
Closed 5 years ago
#3311 closed defect (bug) (fixed)
Problem with custom fields for topics
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 2.6.7 | Priority: | high |
Severity: | major | Version: | 2.6.0 |
Component: | General - Administration | Keywords: | commit |
Cc: |
Description
Custom Field doesn’t work with bbpress 2.6 and above
I use custom fields for bbpress topics.
I tried to turn off all plugins and change the theme to default but always receive next javascript error in the console:
<?php POST https://test.3d-kstudio.com/wp-admin/admin-ajax.php 400 load-scripts.php?c=0&load[chunk_0]=jquery-core,jquery-migrate,utils,suggest,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse&ver=5.3.2:4
PS. I added support to custom-fields using this code
<?php add_filter('bbp_get_topic_post_type_supports', 'register_bbpress_topic_type_supports'); function register_bbpress_topic_type_supports( $args ) { $args[] = 'excerpt'; $args[] = 'thumbnail'; $args[] = 'custom-fields'; return $args ; }
Attachments (1)
Change History (7)
#2
@
5 years ago
This is a difference in sent request data
BBpress 2.6 ( doesn't work )
<?php [04-Aug-2020 10:45:52 UTC] Array ( [_ajax_nonce] => dafc2b7eea [action] => **add-reply** [_ajax_nonce-add-meta] => 44d3f75a6c [meta] => Array ( [266039] => Array ( [key] => main_feature [value] => Updates for \'Save/Export Selected\'. Supports to Substance2 and more. ) ) [post_id] => 14726 [woocommerce-login-nonce] => [_wpnonce] => [woocommerce-reset-password-nonce] => )
BBpress 2.5 ( work )
<?php [04-Aug-2020 10:47:38 UTC] Array ( [_ajax_nonce] => dafc2b7eea [action] => **add-meta** [_ajax_nonce-add-meta] => 44d3f75a6c [meta] => Array ( [266039] => Array ( [key] => main_feature [value] => Updates for \'Save/Export Selected\'. Supports to Substance2 and more. ) ) [post_id] => 14726 [woocommerce-login-nonce] => [_wpnonce] => [woocommerce-reset-password-nonce] => )
#3
@
5 years ago
Currently, this bug can be fixed using the code below.
Also, Replies box should be moved below Custom Fields
<?php /* Fix BBpress 2.6 bug with Custom Fields */ if( function_exists( 'bbp_get_version' ) && version_compare( bbp_get_version(), '2.5' ) > 0 ) { add_action( 'wp_ajax_add-reply', 'wp_ajax_add_fix_bbpress_26'); function wp_ajax_add_fix_bbpress_26() { // print_error_log( $_POST ); // $_POST['action'] = 'add-meta'; wp_ajax_add_meta(); } add_action( 'wp_ajax_delete-reply', 'wp_ajax_delete_fix_bbpress_26'); function wp_ajax_delete_fix_bbpress_26() { // print_error_log( $_POST ); wp_ajax_delete_meta(); } add_action( 'add_meta_boxes', 'bbpress_26_fix_add_meta_boxes', 25 ); function bbpress_26_fix_add_meta_boxes() { do_action( 'bbp_topic_attributes_metabox' ); } }
#4
@
5 years ago
- Component changed from General to General - Administration
- Keywords commit added
- Milestone changed from Awaiting Review to 2.6.7
- Owner set to johnjamesjacoby
- Status changed from new to accepted
- Version changed from 2.6.3 to 2.6.0
I'm able to replicate this bug. The behavior is definitely unintended.
Fix imminent. The problem is duplicate "#the-list
" IDs on the page when the "Replies" meta-box appears before the Custom Fields one.
Reproducing the bug:
Create or edit an existing bbpress topic.
Try to add or edit any custom field.
This will not work.
In the browser's console, you can see the message posted above.