WordPress.org

Ready to get started?Download WordPress

Forums

WP-Ajaxify-Comments
[resolved] 0.12 locking up at the refresh page. (8 posts)

  1. scooterlord
    Member
    Posted 1 year ago #

    Hello, with the new plugin update and AFTER inserting the quick-fix the plugin is crashing when you click on post and the 'reloading page' message appears. Any ideas?

    http://wordpress.org/extend/plugins/wp-ajaxify-comments/

  2. janjonas
    Member
    Plugin Author

    Posted 1 year ago #

    Hi scooterlord,

    please try upgrading to 0.12.1.
    If this does not fix the problems, please send me a link where I can reproduce the problem...

  3. scooterlord
    Member
    Posted 1 year ago #

    Hello,

    same problem again...

    http://www.nicksotiriadis.gr/concept-boots/

    try clicking on post for an empty post comment.

  4. janjonas
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    the problem is, that the script http://www.nicksotiriadis.gr/wp-comments-post.php does not return a HTTP status code 500 when sending invalid data (like an empty comment), but a HTTP status code 200 which indicates, that the comment was posted successfully.
    Did the plugin work before updating to 0.12.x? If yes: Have you also updated other plugins or do you use any other plugins that could change the HTTP status code?

    Hope this helps...

  5. scooterlord
    Member
    Posted 1 year ago #

    Hello,

    no I haven't updated any plugins other than yours. How can a comment be added successfully if it's empty?

    I just realized what the problem is -but have no idea how to fix this; I am using the following code to add my custom error page - because I am using the easy digital download page that uses the horrible wp_die function. Removing the following code from my functions.php seems to solve my problem:

    add_filter('wp_die_handler', 'get_my_error_handler');
    
    function get_my_error_handler() {
        return 'my_error_handler';
    }
    
    function my_error_handler($message, $title='', $args=array()) {
     $errorTemplate = get_theme_root().'/'.get_template().'/commenterror.php';
      if(!is_admin() && file_exists($errorTemplate)) {
        $defaults = array( 'response' => 500 );
        $r = wp_parse_args($args, $defaults);
        $have_gettext = function_exists('__');
        if ( function_exists( 'is_wp_error' ) && is_wp_error( $message ) ) {
            if ( empty( $title ) ) {
                $error_data = $message->get_error_data();
                if ( is_array( $error_data ) && isset( $error_data['title'] ) )
                    $title = $error_data['title'];
            }
            $errors = $message->get_error_messages();
            switch ( count( $errors ) ) :
            case 0 :
                $message = '';
                break;
            case 1 :
                $message = "<p>{$errors[0]}</p>";
                break;
            default :
                $message = "<ul>\n\t\t<li>" . join( "</li>\n\t\t<li>", $errors ) . "</li>\n\t</ul>";
                break;
            endswitch;
        } elseif ( is_string( $message ) ) {
            $message = "<p>$message</p>";
        }
        if ( empty($title) )
            $title = $have_gettext ? __('<strong>An error has been encountered!</strong>') : 'WordPress &rsaquo; Error';
        require_once($errorTemplate);
        die();
     } else {
        _default_wp_die_handler($message, $title, $args);
     }
    }

    any idea on how to have them both working properly?

  6. janjonas
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    I think you have to add the (response) status code 500 in your own error handler. Please try to add the following code after the line "$r = wp_parse_args($args, $defaults);":

    if ( !headers_sent() ) {
      status_header( $r['response'] );
      nocache_headers();
      header( 'Content-Type: text/html; charset=utf-8' );
    }

    Hope this helps...

  7. scooterlord
    Member
    Posted 1 year ago #

    ..I can't thank you enough! Everything seems to be working great! :) Thanks

  8. janjonas
    Member
    Plugin Author

    Posted 1 year ago #

    Thanks for your feedback :)

    Please think about supporting the plugin by making a small donation (http://blog.janjonas.net/donate) or write a short review (http://wordpress.org/support/view/plugin-reviews/wp-ajaxify-comments#postform)...

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.