WordPress.org

Ready to get started?Download WordPress

Forums

Akismet
Trash Can Icon for Dashboard (2 posts)

  1. bhoogterp
    Member
    Posted 1 year ago #

    In the "Right Now" box on the Dashboard, it shows the number of spam comments.. I don't always want to delete all my spam, but sometimes, after a while of ignoring it, it gets up to a couple hundred spam comments, and I don't even want to look through them. It would be nice to have an "Empty All Spam" trash can button right there in that box off the dashboard, so I didn't have to even go to the spam folder to see a hundred or more comments i'm not going to view anyway. I can do it with three clicks, clicking on "Spam", "Empty Spam", and then one more to get back to the Dashboard, but it sure would be convenient to have one right there on the dashboard...

    http://wordpress.org/extend/plugins/akismet/

  2. bhoogterp
    Member
    Posted 1 year ago #

    Sufficient code in a test sample, using some absolute position on the icon element to get around WordPress limitations, demonstrated success on a local install..

    function add_spam_can()
    	{
    	$i = "/wp-content/plugins/admin-bar-tweak/delete-icon.png";		//  Should be path to some nice icon.. also adjust size below
    
    	$n = wp_create_nonce('bulk-comments');
    
    	$x = "";
    	$x .= "/wp-admin/edit-comments.php?comment_status=spam"; 		//  Should get directory from WP settings...
    
    	$x .= "&delete_all=Empty%20Spam";
    	$x .= "&_wpnonce=$n";
    	$x .= "&_wp_http_referer=/wp-admin/";
    	$x .= "&pagegen_timestamp=" . date("Y-m-d H:i:s");
    
    	$s = "";
    	$s .=  "<div style='display:inline-block;position:absolute;top:82px;left:68px;'>";
    	$s .= "<a href='$x'>";
    	$s .= "<img src='$i' width='24' height='24' alt='Empty Spam' title='Empty Spam' />\n";
    	$s .= "</a>";
    	$s .=  "</div>";
    	echo $s;
    	}
    add_action('right_now_table_end', 'add_spam_can',10);

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic