Skip to:
Content
Pages
Categories
Search
Top
Bottom

Custom Field doesn’t work with bbpress 2.6 and above

  • @track77

    Participant

    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:

    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.1:4 POST https://test.3d-kstudio.com/wp-admin/admin-ajax.php 400
    send @ 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.1:4
    ajax @ 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.1:4
    ajaxAdd @ load-scripts.php?c=0&load[chunk_0]=hoverIntent,common,hoverintent-js,admin-bar,wp-ajax-response,jquery-color,wp-lists,jquery-ui-sortable,postbox,jquery-ui-position&load[chunk_1]=,jquery-ui-menu,jquery-ui-autocomplete,tags-suggest,tags-box,word-count,wp-sanitize,post,editor-expand,thickbox,shortcode,backbo&load[chunk_2]=ne,wp-util,wp-backbone,media-models,wp-plupload&ver=5.3.1:9
    i.wpList.<computed> @ load-scripts.php?c=0&load[chunk_0]=hoverIntent,common,hoverintent-js,admin-bar,wp-ajax-response,jquery-color,wp-lists,jquery-ui-sortable,postbox,jquery-ui-position&load[chunk_1]=,jquery-ui-menu,jquery-ui-autocomplete,tags-suggest,tags-box,word-count,wp-sanitize,post,editor-expand,thickbox,shortcode,backbo&load[chunk_2]=ne,wp-util,wp-backbone,media-models,wp-plupload&ver=5.3.1:9
    (anonymous) @ load-scripts.php?c=0&load[chunk_0]=hoverIntent,common,hoverintent-js,admin-bar,wp-ajax-response,jquery-color,wp-lists,jquery-ui-sortable,postbox,jquery-ui-position&load[chunk_1]=,jquery-ui-menu,jquery-ui-autocomplete,tags-suggest,tags-box,word-count,wp-sanitize,post,editor-expand,thickbox,shortcode,backbo&load[chunk_2]=ne,wp-util,wp-backbone,media-models,wp-plupload&ver=5.3.1:9
    dispatch @ 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.1:3
    r.handle @ 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.1:3
Viewing 22 replies - 1 through 22 (of 22 total)
  • @robin-w

    Moderator

    ok, can you start by saying what you mean by ‘custom field’ – is this some code, a plugin or what ?

    @track77

    Participant

    I mean the standard custom fields.
    CF works with bbpress 2.5.14
    https://drive.google.com/file/d/1imUBWx8C7JPokoGgcVnvjs7IAS70o-yd/view?usp=sharing

    @robin-w

    Moderator

    sorry neither ‘standard custom field’ or the image means anything to me – perhaps you could say whether this is code a plugin or where you are seeing this or what you are trying to do etc.

    @track77

    Participant

    I used custom fields with bbpress topics and reply.

    @robin-w

    Moderator

    ok I suspect you are talking about wordpress post custom fields.

    if so, bbpress has never natively supported these, so I suspect you have code or an additional plugin such as acf or a bbpress plugin that is doing this.

    @track77

    Participant

    I use the next code in functions.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 ;
    }

    @robin-w

    Moderator

    hmm – I just added that code to my test site, and it works fine with 2.6.5

    @track77

    Participant

    This is two simple steps for reproducing the bug
    1) Save a new topic as a draft
    2) Write any data to custom fields and press “Add Custom Field”

    @robin-w

    Moderator

    sorry, that all works fine for me

    @track77

    Participant

    Same with a completely new site with a default theme.

    @robin-w

    Moderator

    just did a completely new site – no plugins except bbpress and your code, twentyseventeen theme, works fine.

    when you say ‘save topic as draft’ – what exactly do you mean?

    @track77

    Participant

    topic as draft
    There is no matter. Such functionality doesn’t exist by default.
    The error occurs with any topic status. Main – the topic must be saved.

    @track77

    Participant

    @robin-w

    Moderator

    ok, then yes that is working on a new test site.

    I cannot say why it is not working on yours, sorry πŸ™

    @track77

    Participant

    I made a video. Maybe something we do in different ways.
    https://u.pcloud.link/publink/show?code=XZYoN3kZ17ImJFqXr2mS1lR5VYbO481A3dVy

    @robin-w

    Moderator

    after you enter the custom fields, you have to click ‘update’ on right hand side to update the entries and save !!

    @track77

    Participant

    No – it should save after pressing “Add Custom Field”
    Also delete/update the field and other related options should be work without saving whole topic.

    @robin-w

    Moderator

    sorry, that’s how it works, and how all plugins that I have known use custom fields work. As far as I can see that’s how it worked under 2.5.x – no code change I can see.

    I’m just a user who helps out here, so if you really feel strongly about it, I suggest you log a bug at

    https://bbpress.trac.wordpress.org/

    @track77

    Participant

    This report already exists in the bbpress track.
    7 months ago I posted this bug.
    https://bbpress.trac.wordpress.org/ticket/3311

    @robin-w

    Moderator

    it would have been helpful to tell me this in the original post, and that would have saved a considerable amount of effort by me.

    πŸ™

    @track77

    Participant

    In any case thanks for your time!
    Hope developers will fix this bug soon.

    Currently, this bug can be fixed using the code below.
    Also, Replies box should be moved below Custom Fields

    /* 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' );
    	}
    }

    @robin-w

    Moderator

    thanks for posting that fix, can you add that fix to the trac ticket please πŸ™‚

Viewing 22 replies - 1 through 22 (of 22 total)
  • You must be logged in to reply to this topic.
Skip to toolbar