function wats_comment_update_meta($comment_id)
{
    global $wats_settings;
    wats_load_settings();
    $comment = get_comment($comment_id);
    $status = $comment->comment_approved;
    $post_id = $comment->comment_post_ID;
    if ($status !== "spam" && wats_is_ticket($post_id)) {
        wats_ticket_save_meta($post_id, get_post($post_id), $comment->comment_author_email);
    }
    return;
}
Example #2
0
function wats_comments_template($template)
{
    global $wp_query, $wats_settings;
    if (wats_is_ticket($wp_query->post) == true) {
        if (wats_check_visibility_rights()) {
            if ($wats_settings['template_selector'] == 0) {
                add_filter('comments_open', 'wats_ticket_comments_open', 10, 2);
                add_action('comment_form_comments_closed', 'wats_ticket_comments_closed', 10);
                if (wats_get_ticket_update_rights() == true) {
                    add_filter('comment_form_field_comment', 'wats_comment_form_after_fields', 10, 1);
                }
            } else {
                if (file_exists(get_stylesheet_directory() . '/comments-ticket.php')) {
                    $template = get_stylesheet_directory() . '/comments-ticket.php';
                } else {
                    $template = WATS_THEME_PATH . '/comments-ticket.php';
                }
            }
        } else {
            wp_die(__('You are not allowed to view this ticket.', 'WATS'));
        }
    }
    add_filter('comment_class', 'wats_comment_class');
    return $template;
}