WordPress.org

Forums

WP Ajax Edit Comments
[resolved] Continuation of "Clicking The Edit Link Results In A Blank Popup" (9 posts)

  1. Victor Zen
    Member
    Posted 1 year ago #

    We are having the same problem as the developer @ this issue. When clicking "Edit" to modify a comment, all fields remain blank.

    We are using 5.0.27.0, so the ColourBox fix should be in effect. We disabled it and enabled it again with no luck.

    Here's what we did so you have some more context.

    Big info first: This problem started occurring around a time where we introduced PHP-FPM and APC, so we suspected a caching problem. Looking at the code, we checked your static get_comment() in lib/class.ajax.php and then get_comment() in WP when we saw a jQuery.ajax call targeting the editcomment WP action linked to it. The suspicion grew until we realized that the function wasn't even being called at all, so we ran off to the comment-editor view and poked around there. But that generated more questions than answers.

    Could you help us find the cause for why the fields are not being populated in spite of your recent fixes?

    Your time and expertise is, of course, greatly appreciated. Here's hoping it's something simple and stupid.

    http://wordpress.org/plugins/wp-ajax-edit-comments/

  2. Ronald Huereca
    Member
    Plugin Author

    Posted 1 year ago #

    One thing that could cause this is an invalid JSON object being returned via Ajax. This can be caused by a PHP warning, a WordPress debug warning (if DEBUG is true), and any other text that invalidates the JSON object.

    The first thing I would check is if DEBUG mode is on (in your wp-config) and disable it if it is. Or keep track of what errors it is generating and paste them here.

  3. Victor Zen
    Member
    Posted 1 year ago #

    Hey, thanks for getting in touch!

    I took your response to the sysadmin, and here is his reply:

    oh good, but AEC doesn't work on a fresh install of WP3.6 + AEC (tested on my VM), so there's gotta be more to it than that. otoh, the main WP install does throw a lot of errors, on the third hand, the problem didn't appear until we upgraded to 3.6.

    I'm waiting on the sysadmin to report what exactly is spat out when DEBUG is on. I will post again when I get that info. In the meantime, I hope the info below helps you track down the problem.

    We temporarily brought up a 3.5.2 instance of WP in an unseen corner of production, and I can confirm it worked for me then, but we asked our staff to test AEC there to be double sure. We are now certain PHP-FPM and APC has nothing to do with this.

    I watched the JS execution and AJAX calls in comment-editor.min.js, and found that the POST in o() is passed an integer 0 in the response callback, which supports your hypothesis of an invalidated JSON object. Comment added below with string "<!>" to illustrate.

    function o() {
            a("#status").show();
            a("#status").attr("class", "success");
            a("#message").html(wpajaxeditcommentedit.AEC_Loading);
            jQuery.post(ajaxurl, {action: a("#action").attr("value"),cid: parseInt(a("#commentID").attr("value")),pid: parseInt(a("#postID").attr("value")),_ajax_nonce: a("#_wpnonce").val()}, function(c) {
    
                // <!> c is 0 <!>
    
                var d = !1;
                a("#save").bind("click", function() {
                    p();
                    return !1
                });
                typeof c.error != "undefined" ? (d = !0, a("#status").attr("class", "error"), a("#message").html(c.error), a("#close-option").show(), a("#save").unbind("click")) : (a("#comment").html(c.comment_content), a("#comment").attr("value", c.comment_content), a("#name").attr("value", c.comment_author), a("#e-mail").attr("value", c.comment_author_email), a("#URL").attr("value", c.comment_author_url));
                d || (a("#save, #cancel, #check_spelling").removeAttr("disabled"), a("#status").attr("class", "success"), a("#message").html(wpajaxeditcommentedit.AEC_LoadSuccessful))
            }, "json")
        }

    When I looked through the plugin source, the method tied to a hook via $('#action') in your comment editor was never called.

  4. Ronald Huereca
    Member
    Plugin Author

    Posted 1 year ago #

    Hmm, very strange. I just loaded up a fresh WP 3.6 install with AEC and the popup worked fine. Not sure where to go from here.

    In the off chance you just want comment editing for your non-logged-in users, perhaps try: http://wordpress.org/plugins/simple-comment-editing/

    It's brand new, but does a lot less than Ajax Edit Comments.

  5. Victor Zen
    Member
    Posted 1 year ago #

    Here's the log the sysadmin threw to me, but it doesn't look that relevant.

    [13-Aug-2013 03:30:40 UTC] PHP Notice:  load_plugin_textdomain was called with an argument that is <strong>deprecated</strong> since version 2.7 with no alternative available. in /home/prince/public_html/beta/portal/wp-includes/functions.php on line 2971
    [13-Aug-2013 03:30:40 UTC] PHP Notice:  is_plugin_page is <strong>deprecated</strong> since version 3.1 with no alternative available. in /home/prince/public_html/beta/portal/wp-includes/functions.php on line 2873
    [13-Aug-2013 03:30:40 UTC] PHP Notice:  register_sidebar_widget is <strong>deprecated</strong> since version 2.8! Use wp_register_sidebar_widget() instead. in /home/prince/public_html/beta/portal/wp-includes/functions.php on line 2871
    [13-Aug-2013 03:30:40 UTC] PHP Notice:  register_widget_control is <strong>deprecated</strong> since version 2.8! Use wp_register_widget_control() instead. in /home/prince/public_html/beta/portal/wp-includes/functions.php on line 2871
    [13-Aug-2013 03:30:40 UTC] PHP Notice:  register_sidebar_widget is <strong>deprecated</strong> since version 2.8! Use wp_register_sidebar_widget() instead. in /home/prince/public_html/beta/portal/wp-includes/functions.php on line 2871
    [13-Aug-2013 03:30:40 UTC] PHP Notice:  register_widget_control is <strong>deprecated</strong> since version 2.8! Use wp_register_widget_control() instead. in /home/prince/public_html/beta/portal/wp-includes/functions.php on line 2871
    [13-Aug-2013 03:30:40 UTC] PHP Notice:  wpdb::escape is <strong>deprecated</strong> since version 3.6! Use wpdb::prepare() or esc_sql() instead. in /home/prince/public_html/beta/portal/wp-includes/functions.php on line 2871
    [13-Aug-2013 03:30:40 UTC] PHP Notice:  wpdb::escape is <strong>deprecated</strong> since version 3.6! Use wpdb::prepare() or esc_sql() instead. in /home/prince/public_html/beta/portal/wp-includes/functions.php on line 2871
    [13-Aug-2013 03:30:40 UTC] PHP Notice:  wpdb::escape is <strong>deprecated</strong> since version 3.6! Use wpdb::prepare() or esc_sql() instead. in /home/prince/public_html/beta/portal/wp-includes/functions.php on line 2871
    [13-Aug-2013 03:30:40 UTC] PHP Notice:  wpdb::escape is <strong>deprecated</strong> since version 3.6! Use wpdb::prepare() or esc_sql() instead. in /home/prince/public_html/beta/portal/wp-includes/functions.php on line 2871
    [13-Aug-2013 03:30:40 UTC] PHP Notice:  wpdb::escape is <strong>deprecated</strong> since version 3.6! Use wpdb::prepare() or esc_sql() instead. in /home/prince/public_html/beta/portal/wp-includes/functions.php on line 2871
    [13-Aug-2013 03:30:42 UTC] PHP Notice:  load_plugin_textdomain was called with an argument that is <strong>deprecated</strong> since version 2.7 with no alternative available. in /home/prince/public_html/beta/portal/wp-includes/functions.php on line 2971
    [13-Aug-2013 03:30:42 UTC] PHP Notice:  is_plugin_page is <strong>deprecated</strong> since version 3.1 with no alternative available. in /home/prince/public_html/beta/portal/wp-includes/functions.php on line 2873
    [13-Aug-2013 03:30:42 UTC] PHP Notice:  register_uninstall_hook was called <strong>incorrectly</strong>. Only a static class method or function can be used in an uninstall hook. Please see <a href="http://codex.wordpress.org/Debugging_in_WordPress">Debugging in WordPress</a> for more information. (This message was added in version 3.1.) in /home/prince/public_html/beta/portal/wp-includes/functions.php on line 3012
    [13-Aug-2013 03:30:42 UTC] PHP Notice:  register_sidebar_widget is <strong>deprecated</strong> since version 2.8! Use wp_register_sidebar_widget() instead. in /home/prince/public_html/beta/portal/wp-includes/functions.php on line 2871
    [13-Aug-2013 03:30:42 UTC] PHP Notice:  register_widget_control is <strong>deprecated</strong> since version 2.8! Use wp_register_widget_control() instead. in /home/prince/public_html/beta/portal/wp-includes/functions.php on line 2871
    [13-Aug-2013 03:30:42 UTC] PHP Notice:  register_sidebar_widget is <strong>deprecated</strong> since version 2.8! Use wp_register_sidebar_widget() instead. in /home/prince/public_html/beta/portal/wp-includes/functions.php on line 2871
    [13-Aug-2013 03:30:42 UTC] PHP Notice:  register_widget_control is <strong>deprecated</strong> since version 2.8! Use wp_register_widget_control() instead. in /home/prince/public_html/beta/portal/wp-includes/functions.php on line 2871
    [13-Aug-2013 03:30:42 UTC] PHP Notice:  wpdb::escape is <strong>deprecated</strong> since version 3.6! Use wpdb::prepare() or esc_sql() instead. in /home/prince/public_html/beta/portal/wp-includes/functions.php on line 2871

    Our 3.6 instance uses SSL, whereas our 3.5.2 instance did not. We have discovered that when we request our 3.6 pages using SSL, the plugin works fine. However, forcing a catch-all SSL with RewriteCond %{HTTPS} in .htaccess does NOT solve the problem.

    We looked in your source and saw that the ajaxurl variable used https:// no matter what, whereas all other links switch between http and https

    We want to avoid a catch-all rewrite due to internal issues, but a force SSL on the wp-ajax-edit-comments directory did not work either.

    Any more suggestions are much appreciated, but we might have a way to give more direction to this issue.

    Try this: Add the FORCE_SSL_ADMIN directive on a clean 3.6 install in wp-config.php and tell us if that reproduces the problem.

  6. Victor Zen
    Member
    Posted 1 year ago #

    I realize that you may need an SSL cert to try what I mentioned. My sysadmin will be here soon to add more context so you can offer the most informed opinion on this issue.

    Thank you for your patience thus far.

  7. Strix technica
    Member
    Posted 1 year ago #

    Hi Ronald,

    An unfortunate series of coincidences resulted in several changes being made in close proximity to one another, beginning with the setting of FORCE_SSL_ADMIN. A day later, WP 3.6 was released and our primary WordPress admin (neither Victor nor I, we are primarily responsible for maintenance of the server itself) upgraded to it for the sake of security.

    When trying to diagnose the AEC problem, a restore of the WP 3.5.2 version of the site seemed to indicate no problem (but FORCE_SSL_ADMIN wasn't set back then), and a test install of WP 3.6 (in which I set FORCE_SSL_ADMIN as a matter of course, without even thinking about it — seems foolish in retrospect, but oh well) and AEC showed the problem. Between them, it appeared it was a WP 3.6 problem.

    We've found that with FORCE_SSL_ADMIN, WP 3.6 and AEC 5.0.28, AEC works okay when the https:// version of the page is manually loaded.

    I <i>think</i> what's going on is that, when FORCE_SSL_ADMIN is set, the auth cookies are set to be returned only over secured HTTP (which makes complete sense). Without those auth cookies, fetching of the comment evidently is broken. By switching to the secured page, everything is automatically HTTPS, and therefore it works.

    We'd rather not turn off SSL (for obvious reasons and, anyway, now that the SSL version of the site is in our readers' browser histories, that won't necessarily solve the problem), and I'd rather not force the whole site onto SSL because, amongst other reasons, of server load.

    It would seem that the simplest solution (for anybody using AEC in conjunction with FORCE_SSL_ADMIN) would be to get AEC to submit use https for all of its AJAX requests when that symbol is defined. I'd do it myself but I'm a sys-admin, and not particularly knowledgeable about PHP, JS and AJAX.

    A self-signed certificate would do for testing or, if getting that organised is not convenient on your own servers and you're prepared to switch to email, I'll what I can provide by way of testing platform.

  8. truebird
    Member
    Posted 1 year ago #

    I am having the exact some problem. The editing box and request deletion and everything else pops up blank. I run 3.6 WP. Let me know when this might be fixed please.

  9. Ronald Huereca
    Member
    Plugin Author

    Posted 1 year ago #

    This was an SSL bug. I'm closing as resolved for now. Open up a new thread if the issue still persists.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.