From 86efd149be9293ac80f3a9014b10da49d34b5136 Mon Sep 17 00:00:00 2001 From: Matt Mullenweg Date: Tue, 17 Feb 2004 08:35:04 +0000 Subject: [PATCH] Edit comments improvement, multiple comment delete not implemented yet. git-svn-id: https://develop.svn.wordpress.org/trunk@887 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/admin-functions.php | 10 +++ wp-admin/edit-comments.php | 71 ++++++++++++++++++++-- wp-admin/moderation.php | 8 +-- wp-includes/template-functions-comment.php | 35 +++++++++-- 4 files changed, 110 insertions(+), 14 deletions(-) diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index a2f8f9748f..26fdd037fb 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -1,5 +1,15 @@ 35) + $short_url = substr($short_url, 0, 32).'...'; + return $short_url; +} + function selected($selected, $current) { if ($selected == $current) echo ' selected="selected"'; } diff --git a/wp-admin/edit-comments.php b/wp-admin/edit-comments.php index 755a57a45b..74e0e452fa 100644 --- a/wp-admin/edit-comments.php +++ b/wp-admin/edit-comments.php @@ -2,19 +2,37 @@ $title = 'Edit Comments'; $parent_file = 'edit.php'; require_once('admin-header.php'); +if (empty($_GET['mode'])) $mode = 'view'; +else $mode = $_GET['mode']; ?> - +
Show Comments That Contain... - + + + (Searches within comment text, email, URI, and IP address.)

View Mode | Mass Edit Mode

@@ -27,10 +45,11 @@ if ($s) { comment_author_url LIKE ('%$s%') OR comment_author_IP LIKE ('%$s%') OR comment_content LIKE ('%$s%') - ORDER BY comment_date"); + ORDER BY comment_date DESC"); } else { - $comments = $wpdb->get_results("SELECT * FROM $tablecomments ORDER BY comment_date $commentorder LIMIT 20"); + $comments = $wpdb->get_results("SELECT * FROM $tablecomments ORDER BY comment_date DESC LIMIT 20"); } +if ('view' == $mode) { if ($comments) { echo '
    '; foreach ($comments as $comment) { @@ -58,6 +77,48 @@ if ($s) { '; + } else { + + ?> +

    + No results found.

    + + + + + + + + + + + + '; + foreach ($comments as $comment) { + $bgcolor = ('#eee' == $bgcolor) ? 'none' : '#eee'; +?> + + + + + + + + + +
    *NameEmailIPComment ExcerptEditDelete
    $authordata->user_level) or ($user_login == $authordata->user_login)) { + echo "Edit"; } ?> $authordata->user_level) or ($user_login == $authordata->user_login)) { + echo "comment_post_ID."&comment=".$comment->comment_ID."\" onclick=\"return confirm('You are about to delete this comment by \'".$comment->comment_author."\'\\n \'Cancel\' to stop, \'OK\' to delete.')\" class='delete'>Delete"; } ?>
    +

    Invert Checkbox Selection

    +

    + + @@ -67,7 +128,7 @@ if ($s) {
diff --git a/wp-admin/moderation.php b/wp-admin/moderation.php index 7892530615..6d756315c5 100644 --- a/wp-admin/moderation.php +++ b/wp-admin/moderation.php @@ -96,9 +96,9 @@ default: } ?> comment_ID." } ?> - + ' . $author . ''; } @@ -153,7 +157,7 @@ function comment_author_email_link($linktext='', $before='', $after='') { global $comment; $email = apply_filters('comment_email', $comment->comment_author_email); if ((!empty($email)) && ($email != '@')) { - $display = ($linktext != '') ? $linktext : antispambot(stripslashes($email)); + $display = ($linktext != '') ? $linktext : stripslashes($email); echo $before; echo "$display"; echo $after; @@ -184,6 +188,27 @@ function comment_text() { echo apply_filters('comment_text', $comment_text); } +function comment_excerpt() { + global $comment; + $comment_text = str_replace('', '', $comment->comment_content); + $comment_text = str_replace('', '', $comment_text); + $comment_text = strip_tags($comment_text); + $blah = explode(' ', $comment_text); + if (count($blah) > 20) { + $k = 20; + $use_dotdotdot = 1; + } else { + $k = count($blah); + $use_dotdotdot = 0; + } + $excerpt = ''; + for ($i=0; $i<$k; $i++) { + $excerpt .= $blah[$i] . ' '; + } + $excerpt .= ($use_dotdotdot) ? '...' : ''; + echo apply_filters('comment_excerpt', $excerpt); +} + function comment_date($d='') { global $comment; if ('' == $d) {