/** * Public action 'comment_post' - Store cleantalk hash in comment meta 'ct_hash' * @param int $comment_id Comment ID * @param mixed $comment_status Approval status ("spam", or 0/1), not used */ function ct_set_meta($comment_id, $comment_status) { global $comment_post_id; $hash1 = ct_hash(); if (!empty($hash1)) { update_comment_meta($comment_id, 'ct_hash', $hash1); if (function_exists('base64_encode') && isset($comment_status) && $comment_status != 'spam') { $post_url = ct_post_url($comment_id, $comment_post_id); $post_url = base64_encode($post_url); if ($post_url === false) { return false; } // 01 - URL to approved comment $feedback_request = $hash1 . ':' . '01' . ':' . $post_url . ';'; ct_send_feedback($feedback_request); } } return true; }
/** * On the scheduled action hook, run the function. */ function ct_do_this_hourly() { global $ct_options, $ct_data; // do something every hour if (!isset($ct_options)) { $ct_options = ct_get_options(); } if (!isset($ct_data)) { $ct_data = ct_get_data(); } delete_spam_comments(); ct_send_feedback(); }