WordPress.org

Ready to get started?Download WordPress

Forums

Error Deleting Spam Comments (2 posts)

  1. Bink
    Member
    Posted 9 years ago #

    I am not using any spam aid (yet) with WordPress. After my MovableType import I realized I have TONS! of spam comments. I tried the "mass edit" option and I am getting the following error message, "Warning: Invalid argument supplied for foreach() in /home/binkolog/public_html/memoir/wp-admin/edit-comments.php on line 42

    0 comments deleted."

    Line 38 to 52 of this file looks like this:
    '<?php _e('View Mode') ?> | <?php _e('Mass Edit Mode') ?>
    <?php
    if ( !empty( $_POST['delete_comments'] ) ) :
    $i = 0;
    foreach ($_POST['delete_comments'] as $comment) : // Check the permissions on each
    $comment = (int) $comment;
    $post_id = $wpdb->get_var("SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = $comment");
    $authordata = get_userdata( $wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $post_id") );
    if ( user_can_delete_post_comments($user_ID, $post_id) ) :
    $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_ID = $comment");
    ++$i;
    endif;
    endforeach;
    echo "<div class='wrap'>" . sprintf(__('%s comments deleted.'), $i) . "</div>";
    endif;'

    Any help to fix this problem would be greatly appreciated. Thanks!

  2. Bink
    Member
    Posted 9 years ago #

    I found a fix. Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.