$form_obj]; ob_start(); wpcomment_load_input_templates( 'frontend/wpcomment-fields.php', $template_vars ); $wpcomment_html .= ob_get_clean(); echo apply_filters('wpcomment_fields_html', $wpcomment_html, $form_obj); } function save_comment_meta_fields($comment_id){ // wpcomment_pa($_POST); exit; if( !isset($_POST['wp-comment-fields']) ) return ''; add_comment_meta( $comment_id, 'wpcomment_fields', $_POST['wp-comment-fields'] ); } function render_comment_meta_front( $comment_text, $comment ) { // if admin disable frontend extra fields if( wpcomment_disable_extra_fields() ) return $comment_text; $comment_meta_text = $this->get_comment_meta_by_comment_id($comment->comment_ID); if($comment_meta_text){ $comment_text .= $comment_meta_text; } return $comment_text; } // getting comment meta by comment id for global use function get_comment_meta_by_comment_id($comment_id){ $comment_meta = get_comment_meta( $comment_id, 'wpcomment_fields', true ); $comment_text = ''; // if wpcomment_fields found then it is latest version if( isset($comment_meta['fields']) ) { $comment_text = $this->comment_fields($comment_meta); }else{ $comment_text = $this->comment_fields_legacy(); } return apply_filters('wpcomment_comment_meta', $comment_text); } function comment_fields($comment_meta) { // wpcomment_pa($comment_meta); $comment = ''; if ( $comment_meta ) { $comment_meta_heading = WPCOMMENT_ADMIN()::get_option('wpcomment_heading'); if ( $comment_meta_heading != '' ) { $comment .= sprintf(__('
', 'wp-comment-fields'), $comment_meta_heading); } $comment .= wpcomment_render_comment_meta($comment_meta); } return $comment; } function comment_fields_legacy() { $comment_meta = get_option( 'wpcomment_meta' ); // ppom_pa($comment_meta); if($comment_meta){ $comment_meta_heading = WPCOMMENT_ADMIN()::get_option('wpcomment_heading'); if($comment_meta_heading != '') $comment = ''.sprintf(__('%s'), $comment_meta_heading).'
'; $comment .= '