function xt_update_comment($commentarr) { global $wpdb; // First, get all of the original fields $comment = xt_get_comment($commentarr['id'], ARRAY_A); // Escape data pulled from DB. $comment = esc_sql($comment); $old_status = $comment['status']; // Merge old and new fields with new fields overwriting old ones. $commentarr = array_merge($comment, $commentarr); $commentarr = xt_filter_comment($commentarr); // Now extract the merged array. extract(stripslashes_deep($commentarr), EXTR_SKIP); $content = apply_filters('xt_comment_save_pre', $content); $create_date = get_gmt_from_date($create_date); if (!isset($status)) { $status = 1; } else { if ('unapproved' == $status) { $status = 0; } else { if ('approved' == $status) { $status = 1; } } } $data = compact('content', 'user_name', 'status', 'create_date'); $rval = $wpdb->update(XT_TABLE_SHARE_COMMENT, $data, compact('id')); xt_update_comment_count($share_id); do_action('xt_edit_comment', $id); $comment = xt_get_comment($id); return $rval; }
function xt_get_comment_text($id = 0, $content = '') { $_content = ''; if ($content != '') { $_content = $content; } else { $comment = xt_get_comment($id); $_content = $comment->content; } return apply_filters('xt_comment_text', $_content); }