Support » Plugins and Hacks » Editing Akismet stuff in dashboard

  • I’m really enjoying akismet and it’s doing a great job of catching those nasty spammers (touch wood).

    But I want to change what it tells me in the dashboard – it’s all very well knowing how many chunks of spam it’s caught since I installed it but what I really want to know is how many chunks it has caught since I deleted the last lot.

    I’ve identified the code in akismet.php that needs changing but I don’t know what to change it to!

    <?php
    }
    }

    add_action('admin_menu', 'ksd_manage_page');

    function akismet_stats() {
    $count = get_option('akismet_spam_count');
    if ( !$count )
    return;
    $path = plugin_basename(__FILE__);
    echo '<h3>'.__('Spam').'</h3>';
    echo '<p>'.sprintf(__('<a href="%1$s">Akismet</a> has protected your site from <a href="%2$s">%3$s spam comments</a>.'), 'http://akismet.com/', "edit.php?page=$path", $count).'</p>';
    }

    add_action('activity_box_end', 'akismet_stats');

    ?>

    Any suggestions gratefully received!

Viewing 8 replies - 1 through 8 (of 8 total)
  • Uh, doesn’t Akismet already report this? Here’s what I see before the “Delete all” button on its admin page:

    There are currently 12 comments identified as spam.

    That would be the chunks caught since the last delete.

    As I said, I want to change what it says in the Dashboard

    Sorry, didn’t understand your request fully as I’m only running Akismet on WP 1.5.2, and there’s no Dashboard section for it with that version (hey, always something to learn). Try this:

    function akismet_stats() {
    $count = get_option('akismet_spam_count');
    if ( !$count )
    return;
    $path = plugin_basename(__FILE__);
    echo '<h3>'.__('Spam').'</h3>';
    echo '<p>'.sprintf(__('<a href="%1$s">Akismet</a> has protected your site from <a href="%2$s">%3$s spam comments</a>.'), 'http://akismet.com/', "edit.php?page=$path", $count);
    $spam_count = ksd_spam_count();
    printf(__('There are currently %1$s comments identified as spam.'), $spam_count);
    echo '</p>';

    }

    Sorry about that – only sarted using akismet when I upgraded to wp2 so didn’t realise this was a new feature!

    Anyway, tried your suggestion, but it didn’t work – in fact it managed to break the whole site!

    It helps to know what the error is that is actually breaking the site. 🙂

    Note I made only a small change to the akismet_stats() function in the plugin file and tested it before posting the function. Here’s the modded version of akismet.php, in full, which I (now) have running on two WP 2.0 sites:

    http://paste.uni.cc/8433

    Go to the end, click the download link, and save the file as akismet.php.

    That’s brilliant! Thank you 🙂

    I downloaded the file, put it on the server, and received the following error:

    Parse error: parse error, unexpected T_STRING in /home/.quintin/silverblue/thesilverblue.com/wp/wp-content/plugins/akismet/akismet.php on line 34

    No big deal as Dashboard would have just been a fun feature, but I’m not stressing. Thanks for all you do, Kafka!

    Someone can give me the code I need to display the Akismet status in my layout? Or in a single post?

    Thx!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Editing Akismet stuff in dashboard’ is closed to new replies.