Make WordPress Core

Changeset 4265


Ignore:
Timestamp:
10/02/2006 06:19:44 PM (19 years ago)
Author:
ryan
Message:

Pluggable comment throttling from Mark Jaquith. fixes #3175

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/comment.php

    r4196 r4265  
    188188        $time_lastcomment = mysql2date('U', $lasttime);
    189189        $time_newcomment  = mysql2date('U', $comment_date_gmt);
    190         if ( ($time_newcomment - $time_lastcomment) < 15 ) {
     190        $flood_die = apply_filters('comment_flood_filter', false, $time_lastcomment, $time_newcomment);
     191        if ( $flood_die ) {
    191192            do_action('comment_flood_trigger', $time_lastcomment, $time_newcomment);
    192             wp_die( __('Sorry, you can only post a new comment once every 15 seconds. Slow down cowboy.') );
     193            wp_die( __('You are posting comments too quickly.  Slow down.') );
    193194        }
    194195    }
     
    354355    $commentdata['filtered'] = true;
    355356    return $commentdata;
     357}
     358
     359function wp_throttle_comment_flood($block, $time_lastcomment, $time_newcomment) {
     360    if ( $block ) // a plugin has already blocked... we'll let that decision stand
     361        return $block;
     362    if ( ($time_newcomment - $time_lastcomment) < 15 )
     363        return true;
     364    return false;
    356365}
    357366
  • trunk/wp-includes/default-filters.php

    r4201 r4265  
    3838
    3939add_filter('comment_email', 'antispambot');
     40
     41add_filter('comment_flood_filter', 'wp_throttle_comment_flood', 10, 3);
    4042
    4143add_filter('comment_url', 'clean_url');
Note: See TracChangeset for help on using the changeset viewer.