Changeset 3529

Show
Ignore:
Timestamp:
02/14/06 20:09:13 (3 years ago)
Author:
ryan
Message:

Option to 'mark as spam' in notification e-mail from Mark J. fixes #1048

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-admin/edit-comments.php

    r3517 r3529  
    4444        $comment = (int) $comment; 
    4545        $post_id = $wpdb->get_var("SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = $comment"); 
    46         $authordata = get_userdata( $wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $post_id") ); 
    47         if ( current_user_can('edit_post', $post_id) ) : 
    48             wp_set_comment_status($comment, "delete"); 
     46        // $authordata = get_userdata( $wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $post_id") ); 
     47        if ( current_user_can('edit_post', $post_id) ) { 
     48            if ( !empty( $_POST['spam_button'] ) ) 
     49                wp_set_comment_status($comment, 'spam'); 
     50            else 
     51                wp_set_comment_status($comment, 'delete'); 
    4952            ++$i; 
    50         endif; 
     53        } 
    5154    endforeach; 
    52     echo "<div class='wrap'><p>" . sprintf(__('%s comments deleted.'), $i) . "</p></div>"; 
     55    echo '<div style="background-color: rgb(207, 235, 247);" id="message" class="updated fade"><p>'; 
     56    if ( !empty( $_POST['spam_button'] ) ) 
     57        printf(__('%s comments marked as spam.'), $i); 
     58    else 
     59        printf(__('%s comments deleted.'), $i); 
     60    echo '</p></div>'; 
    5361endif; 
    5462 
     
    97105            if ( current_user_can('edit_post', $comment->comment_post_ID) ) { 
    98106                echo " | <a href=\"post.php?action=editcomment&amp;comment=".$comment->comment_ID."\">" . __('Edit Comment') . "</a>"; 
    99                 echo " | <a href=\"post.php?action=deletecomment&amp;p=".$comment->comment_post_ID."&amp;comment=".$comment->comment_ID."\" onclick=\"return deleteSomething( 'comment', $comment->comment_ID, '" . sprintf(__("You are about to delete this comment by &quot;%s&quot;.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to delete."), wp_specialchars( $comment->comment_author, 1 ))  . "' );\">" . __('Delete Comment') . "</a> &#8212; "; 
     107                echo " | <a href=\"post.php?action=deletecomment&amp;p=".$comment->comment_post_ID."&amp;comment=".$comment->comment_ID."\" onclick=\"return deleteSomething( 'comment', $comment->comment_ID, '" . sprintf(__("You are about to delete this comment by &quot;%s&quot;.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to delete."), wp_specialchars( $comment->comment_author, 1 ))  . "' );\">" . __('Delete Comment') . "</a> "; 
     108                echo " | <a href=\"post.php?action=deletecomment&amp;delete_type=spam&amp;p=".$comment->comment_post_ID."&amp;comment=".$comment->comment_ID."\" onclick=\"return deleteSomething( 'comment-as-spam', $comment->comment_ID, '" . sprintf(__("You are about to mark as spam this comment by &quot;%s&quot;.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to mark as spam."), wp_specialchars( $comment->comment_author, 1 ))  . "' );\">" . __('Mark Comment as Spam') . "</a> "; 
    100109            } // end if any comments to show 
    101110            // Get post title 
     
    103112                $post_title = $wpdb->get_var("SELECT post_title FROM $wpdb->posts WHERE ID = $comment->comment_post_ID"); 
    104113                $post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title; 
    105                 ?> <a href="post.php?action=edit&amp;post=<?php echo $comment->comment_post_ID; ?>"><?php printf(__('Edit Post &#8220;%s&#8221;'), stripslashes($post_title)); ?></a> 
     114                ?> | <a href="post.php?action=edit&amp;post=<?php echo $comment->comment_post_ID; ?>"><?php printf(__('Edit Post &#8220;%s&#8221;'), stripslashes($post_title)); ?></a> 
    106115                <?php } ?> 
    107116             | <a href="<?php echo get_permalink($comment->comment_post_ID); ?>"><?php _e('View Post') ?></a></p> 
     
    155164    ?></table> 
    156165    <p><a href="javascript:;" onclick="checkAll(document.getElementById('deletecomments')); return false; "><?php _e('Invert Checkbox Selection') ?></a></p> 
    157             <p class="submit"><input type="submit" name="Submit" value="<?php _e('Delete Checked Comments') ?> &raquo;" onclick="return confirm('<?php _e("You are about to delete these comments permanently \\n  \'Cancel\' to stop, \'OK\' to delete.") ?>')" /> </p> 
     166            <p class="submit"><input type="submit" name="delete_button" value="<?php _e('Delete Checked Comments') ?> &raquo;" onclick="return confirm('<?php _e("You are about to delete these comments permanently \\n  \'Cancel\' to stop, \'OK\' to delete.") ?>')" /> 
     167            <input type="submit" name="spam_button" value="<?php _e('Mark Checked Comments as Spam') ?> &raquo;" onclick="return confirm('<?php _e("You are about to mark these comments as spam \\n  \'Cancel\' to stop, \'OK\' to mark as spam.") ?>')" /></p> 
    158168  </form> 
    159169<?php 
  • trunk/wp-admin/list-manipulation.js

    r3517 r3529  
    3333    ajaxDel.onLoaded = function() { ajaxDel.myResponseElement.innerHTML = 'Data Sent...'; }; 
    3434    ajaxDel.onInteractive = function() { ajaxDel.myResponseElement.innerHTML = 'Processing Data...'; }; 
    35     ajaxDel.onCompletion = function() { removeThisItem( what + '-' + id ); }; 
     35    ajaxDel.onCompletion = function() { removeThisItem( what.replace('-as-spam', '') + '-' + id ); }; 
    3636    ajaxDel.runAJAX('action=delete-' + what + '&id=' + id); 
    3737    return false; 
  • trunk/wp-admin/list-manipulation.php

    r3517 r3529  
    6464    } 
    6565    break; 
     66case 'delete-comment-as-spam' : 
     67    $id = (int) $_POST['id']; 
     68 
     69    if ( !$comment = get_comment($id) ) 
     70        die('0'); 
     71    if ( !current_user_can('edit_post', $comment->comment_post_ID) ) 
     72        die('-1'); 
     73 
     74    if ( wp_set_comment_status($comment->comment_ID, 'spam') ) { 
     75        die('1'); 
     76    } else { 
     77        die('0'); 
     78    } 
     79    break; 
    6680case 'delete-link-category' : 
    6781    $id = (int) $_POST['id']; 
  • trunk/wp-admin/post.php

    r3517 r3529  
    185185 
    186186    echo "<div class='wrap'>\n"; 
    187     echo "<p>" . __('<strong>Caution:</strong> You are about to delete the following comment:') . "</p>\n"; 
     187    if ( 'spam' == $_GET['delete_type'] ) 
     188        echo "<p>" . __('<strong>Caution:</strong> You are about to mark the following comment as spam:') . "</p>\n"; 
     189    else 
     190        echo "<p>" . __('<strong>Caution:</strong> You are about to delete the following comment:') . "</p>\n"; 
    188191    echo "<table border='0'>\n"; 
    189192    echo "<tr><td>" . __('Author:') . "</td><td>$comment->comment_author</td></tr>\n"; 
     
    196199    echo "<form action='".get_settings('siteurl')."/wp-admin/post.php' method='get'>\n"; 
    197200    echo "<input type='hidden' name='action' value='deletecomment' />\n"; 
     201    if ( 'spam' == $_GET['delete_type'] ) 
     202        echo "<input type='hidden' name='delete_type' value='spam' />\n"; 
    198203    echo "<input type='hidden' name='p' value='$p' />\n"; 
    199204    echo "<input type='hidden' name='comment' value='{$comment->comment_ID}' />\n"; 
     
    227232        die( __('You are not allowed to edit comments on this post.') ); 
    228233 
    229     wp_set_comment_status($comment->comment_ID, "delete"); 
    230     do_action('delete_comment', $comment->comment_ID); 
     234    if ( 'spam' == $_GET['delete_type'] ) 
     235        wp_set_comment_status($comment->comment_ID, 'spam'); 
     236    else 
     237        wp_delete_comment($comment->comment_ID); 
    231238 
    232239    if (($_SERVER['HTTP_REFERER'] != "") && (false == $noredir)) { 
  • trunk/wp-includes/pluggable-functions.php

    r3517 r3529  
    333333    $notify_message .= get_permalink($comment->comment_post_ID) . "#comments\r\n\r\n"; 
    334334    $notify_message .= sprintf( __('To delete this comment, visit: %s'), get_settings('siteurl').'/wp-admin/post.php?action=confirmdeletecomment&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n"; 
     335    $notify_message .= sprintf( __('To mark this comment as spam, visit: %s'), get_settings('siteurl').'/wp-admin/post.php?action=confirmdeletecomment&delete_type=spam&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n"; 
    335336 
    336337    $wp_email = 'wordpress@' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME'])); 
     
    390391    $notify_message .= sprintf( __('To approve this comment, visit: %s'),  get_settings('siteurl').'/wp-admin/post.php?action=mailapprovecomment&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n"; 
    391392    $notify_message .= sprintf( __('To delete this comment, visit: %s'), get_settings('siteurl').'/wp-admin/post.php?action=confirmdeletecomment&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n"; 
     393    $notify_message .= sprintf( __('To mark this comment as spam, visit: %s'), get_settings('siteurl').'/wp-admin/post.php?action=confirmdeletecomment&delete_type=spam&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n"; 
    392394    $notify_message .= sprintf( __('Currently %s comments are waiting for approval. Please visit the moderation panel:'), $comments_waiting ) . "\r\n"; 
    393395    $notify_message .= get_settings('siteurl') . "/wp-admin/moderation.php\r\n";