WordPress.org

Ready to get started?Download WordPress

Forums

AJAX Comment Delete Not Working - Comments Reappear (3 posts)

  1. ShaolinTiger
    Member
    Posted 7 years ago #

    I have a strange problem, when I delete a comment from the admin panel via the delete button, the confirmation pop-up appears, so I click OK.

    Then the comment turns red and disappears, as usual and expected.

    But then after half a second or so, it just comes back, it reappears the same way it disappeared, but the cell is still red.

    After refreshing the comments page (edit-comments.php) it shows the comment is still there and wasn't deleted.

    Has anyone encountered this before?

    It's a bit annoying, I can still delete via mass delete but it's not as convenient as deleting via the main page.

  2. MichaelH
    Member
    Posted 7 years ago #

    Any plugins that might be tripping you up?

  3. ShaolinTiger
    Member
    Posted 7 years ago #

    Hi, I found the solution to my problem here:

    http://wordpress.org/support/topic/103953

    It's to do with AJAX referal checking.

    It was fixable by replacing the code

    `$cookie = explode('; ', urldecode(empty($_POST['cookie']) ? $_GET['cookie'] : $_POST['cookie'])); // AJAX scripts must pass cookie=document.cookie
    foreach ( $cookie as $tasty ) {
    if ( false !== strpos($tasty, USER_COOKIE) )
    $user = substr(strstr($tasty, '='), 1);
    if ( false !== strpos($tasty, PASS_COOKIE) )
    $pass = substr(strstr($tasty, '='), 1);
    }`

    with simply

    ` $user = $_COOKIE[USER_COOKIE];
    $pass = $_COOKIE[PASS_COOKIE];`

    This is in wp-includes/pluggable.php (in the function check_ajax_referer).

Topic Closed

This topic has been closed to new replies.

About this Topic