WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )
apply_filters( "hook_name", "what_to_filter" )
.Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 5 times in this file.
Line | Code |
---|---|
164 | // if the response is neither true nor false, hold the comment for moderation and schedule a recheck |
165 | if ( 'true' != $response[1] && 'false' != $response[1] ) { |
166 | if ( !current_user_can('moderate_comments') ) { |
167 | // Comment status should be moderated |
168 | self::$last_comment_result = '0'; |
169 | } |
170 | if ( function_exists('wp_next_scheduled') && function_exists('wp_schedule_single_event') ) { |
171 | if ( !wp_next_scheduled( 'akismet_schedule_cron_recheck' ) ) { |
172 | wp_schedule_single_event( time() + 1200, 'akismet_schedule_cron_recheck' ); |
173 | do_action( 'akismet_scheduled_recheck', 'invalid-response-' . $response[1] ); |
174 | } |
175 | } |
176 |
|
177 | self::$prevent_moderation_email_for_these_comments[] = $commentdata; |
178 | } |
179 |
|
180 | if ( function_exists('wp_next_scheduled') && function_exists('wp_schedule_event') ) { |
181 | // WP 2.1+: delete old comments daily |
182 | if ( !wp_next_scheduled( 'akismet_scheduled_delete' ) ) |
Line | Code |
571 | public static function cron_recheck() { |
572 | global $wpdb; |
573 |
|
574 | $api_key = self::get_api_key(); |
575 |
|
576 | $status = self::verify_key( $api_key ); |
577 | if ( get_option( 'akismet_alert_code' ) || $status == 'invalid' ) { |
578 | // since there is currently a problem with the key, reschedule a check for 6 hours hence |
579 | wp_schedule_single_event( time() + 21600, 'akismet_schedule_cron_recheck' ); |
580 | do_action( 'akismet_scheduled_recheck', 'key-problem-' . get_option( 'akismet_alert_code' ) . '-' . $status ); |
581 | return false; |
582 | } |
583 |
|
584 | delete_option('akismet_available_servers'); |
585 |
|
586 | $comment_errors = $wpdb->get_col( "SELECT comment_id FROM {$wpdb->commentmeta} WHERE meta_key = 'akismet_error' LIMIT 100" ); |
587 | |
588 | load_plugin_textdomain( 'akismet' ); |
589 |
|
Line | Code |
633 | // If this comment has been pending moderation for longer than MAX_DELAY_BEFORE_MODERATION_EMAIL, |
634 | // send a moderation email now. |
635 | if ( ( intval( gmdate( 'U' ) ) - strtotime( $comment->comment_date_gmt ) ) < self::MAX_DELAY_BEFORE_MODERATION_EMAIL ) { |
636 | delete_comment_meta( $comment_id, 'akismet_delayed_moderation_email' ); |
637 | wp_notify_moderator( $comment_id ); |
638 | } |
639 |
|
640 | delete_comment_meta( $comment_id, 'akismet_rechecking' ); |
641 | wp_schedule_single_event( time() + 1200, 'akismet_schedule_cron_recheck' ); |
642 | do_action( 'akismet_scheduled_recheck', 'check-db-comment-' . $status ); |
643 | return; |
644 | } |
645 | delete_comment_meta( $comment_id, 'akismet_rechecking' ); |
646 | } |
647 |
|
648 | $remaining = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->commentmeta} WHERE meta_key = 'akismet_error'" ); |
649 | if ( $remaining && !wp_next_scheduled('akismet_schedule_cron_recheck') ) { |
650 | wp_schedule_single_event( time() + 1200, 'akismet_schedule_cron_recheck' ); |
651 | do_action( 'akismet_scheduled_recheck', 'remaining' ); |
652 | } |
653 | } |
654 |
|
655 | public static function fix_scheduled_recheck() { |
656 | $future_check = wp_next_scheduled( 'akismet_schedule_cron_recheck' ); |
657 | if ( !$future_check ) { |
658 | return; |
659 | } |
660 |
|
661 | if ( get_option( 'akismet_alert_code' ) > 0 ) { |
662 | return; |
663 | } |
664 |
|
665 | $check_range = time() + 1200; |
666 | if ( $future_check > $check_range ) { |
667 | wp_clear_scheduled_hook( 'akismet_schedule_cron_recheck' ); |
668 | wp_schedule_single_event( time() + 300, 'akismet_schedule_cron_recheck' ); |
669 | do_action( 'akismet_scheduled_recheck', 'fix-scheduled-recheck' ); |
670 | } |
671 | } |
672 |
|
673 | public static function add_comment_nonce( $post_id ) { |
674 | echo '<p style="display: none;">'; |
675 | wp_nonce_field( 'akismet_comment_nonce_' . $post_id, 'akismet_comment_nonce', FALSE ); |
676 | echo '</p>'; |
677 | } |
678 |
|