• Resolved kallumamaji

    (@kallumamaji)


    I am using wordpress multisite version 4.7.4 with buddypress

    commentpress error

    “AJAX error!

    TypeError: c is undefined” on attemting to save comments

    is appearing on every possible configuration like multisite activation, individual blog activation, with buddypress groupblog activation etc

    commentpress version Version:
    3.9.3

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Christian Wach

    (@needle)

    Do you have a link where I could see this happening?

    We have the same issue in commentpress-core:3.9.3. It happens when the comment being added is the first on its paragraph, because line 958 of cp-ajax-comments.js calls last_id.toString() but last_id is empty due to this being the first comment (see line 945 last_id = $(last).prop(‘id’); ).

    The plugin should definitely not alert() this error in any case, but I’m not sure how you want to handle it or I would be happy to submit a PR myself.

    You can see it in action at https://cyborguniversity.hcommons.org/.

    Plugin Author Christian Wach

    (@needle)

    @cyclic Thanks for the report. I (kind of) agree that errors should be logged to the console if it exists, but often this is a symptom of a deeper issue as you can see from the history of reports here. It’s thankfully also relatively rare.

    I’d like to know a little more about your setup, because I cannot reproduce this error locally regardless of which PHP version, WordPress version or which combination of plugins I use. If you’d prefer to take this conversation off this public forum to discuss this, please email me at cpdev@futureofthebook.org.

    I discovered that disabling the comment group of our Redis object cache makes the comments show up under the correct paragraph and thereby fixes the JS error. Here’s how I did it:

    /**
     * Comments are not nested correctly if caching is on, so disable it for commentpress.
     */
    function hcommons_selectively_disable_object_cache() {
    	$theme = wp_get_theme();
    
    	if ( false !== strpos( strtolower( $theme->get( 'Name' ) ), 'commentpress' ) ) {
    		wp_cache_add_non_persistent_groups( array( 'comment' ) );
    	}
    }
    add_action( 'plugins_loaded', 'hcommons_selectively_disable_object_cache' );
    • This reply was modified 7 years, 6 months ago by Ryan Williams.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘AJAX error!’ is closed to new replies.