function get_reported_comments($results)
    {
        $count_flag = 0;
        foreach ($results as $value) {
            $comment_id = $value['comment_ID'];
            // Check for the flagged commets
            $flagged_reports = get_comment_meta($comment_id, 'comment_flagged_reports', true);
            if (!empty($flagged_reports)) {
                $count_flag = $count_flag + count($flagged_reports);
            }
            if (!empty($flagged_reports)) {
                foreach ($flagged_reports as $key1 => $value1) {
                    ?>

					<tr>
						
						<td class="author column-author">
							
							<strong>

								<?php 
                    $comment_form = new wpad_frontend_comment_form();
                    $option = get_option('wpad_comment_form');
                    $commnet_form_id = get_comment_meta($comment_id, 'wpad_comment_form_id', true);
                    $form_ids = !empty($option[$commnet_form_id]) ? $option[$commnet_form_id] : '';
                    $wpad_advance_comment = new wpad_advance_comment();
                    $object = $wpad_advance_comment->get_comment_in_array($comment_id);
                    echo $comment_form->validate_gravatar($value['comment_author_email'], $form_ids, $object, 32);
                    ?>

								<?php 
                    echo $value['comment_author'];
                    ?>

							</strong>

							<br>

							<a href="mailto:<?php 
                    echo $value['comment_author_email'];
                    ?>
">

								<?php 
                    echo $value['comment_author_email'];
                    ?>

							</a>

							<br>	

							<?php 
                    echo $value['comment_author_IP'];
                    ?>

						</td>

						<td class="comment column-comment">

							<div class="submitted-on">

								<?php 
                    _e("Submitted on", 'wpad');
                    $post_link = $wpad_advance_comment->get_comment_link($value['comment_post_ID'], $value['comment_ID']);
                    ?>

								<a href="<?php 
                    echo $post_link;
                    ?>
" target="blank" >

									<?php 
                    echo date('d M, Y \\a\\t g:i a', strtotime($value['comment_date_gmt']));
                    ?>

								</a> 

							</div>

							<p><?php 
                    echo $value['comment_content'];
                    ?>
</p>

						</td>
					
						<td class="report column-report">
							<strong><?php 
                    _e("Option Selected :", 'wpad');
                    ?>
 </strong>
							<br>
							<p><?php 
                    echo $value1['option'];
                    ?>
</p>

							<?php 
                    if (!empty($value1['message'])) {
                        ?>

								<br><strong><?php 
                        _e("User Message : ", 'wpad');
                        ?>
</strong>
								<br>
								<p><?php 
                        echo $value1['message'];
                        ?>
</p>
								
								<?php 
                    }
                    ?>

						</td>

						<td class="response column-response">

							<div class="response-links">

								<span class="post-com-count-wrapper">

									<a href="<?php 
                    echo get_edit_post_link($value['comment_post_ID']);
                    ?>
" class="comments-edit-item-link">

										<?php 
                    echo get_the_title($value['comment_post_ID']);
                    ?>
 

									</a>

									<?php 
                    $wpad_advance_comment->view_page($value['comment_post_ID']);
                    ?>

									<span class="post-com-count-wrapper">

										<a class="post-com-count post-com-count-approved" href="javascript:void(0)">

											<span class="comment-count-approved"><?php 
                    $wpad_advance_comment->comment_count($value['comment_post_ID']);
                    ?>
</span>

										</a>

									</span>

								</span> 
								
							</div>

						</td>

					</tr>

					<?php 
                }
            }
        }
        if ($count_flag < 1) {
            ?>

			<tr>
				<td colspan="4" style="text-align:center">
					<?php 
            _e('No flagged comments found for this post.', 'wpad');
            ?>
				</td>
			</tr>

			<?php 
        }
    }
    function get_comment_details($results)
    {
        ?>

		<table class="form-table editcomment">

			<tbody>

				<tr>

					<td class="first"><?php 
        _e("Profile Pic :", 'wpad');
        ?>
</td>

					<td>
						<?php 
        $comment_form = new wpad_frontend_comment_form();
        $wpad_advance_comment = new wpad_advance_comment();
        $object = $wpad_advance_comment->get_comment_in_array($_GET['parentid']);
        $option = get_option('wpad_comment_form');
        $commnet_form_id = $_GET['formid'];
        if (!empty($option[$commnet_form_id])) {
            echo $comment_form->validate_gravatar($results[0]['comment_author_email'], $option[$commnet_form_id], $object, 150);
        } else {
            echo $comment_form->validate_gravatar($results[0]['comment_author_email'], null, $object, 150);
        }
        ?>
					</td>

				</tr>

				<tr>

					<td class="first"><?php 
        _e("Name :", 'wpad');
        ?>
</td>

					<td><?php 
        echo $results[0]['comment_author'];
        ?>
</td>

				</tr>

				<tr>

					<td class="first">

					<?php 
        _e("E-mail", 'wpad');
        ?>
 ( <a href="mailto:<?php 
        echo $results[0]['comment_author_email'];
        ?>
"><?php 
        _e("Send E-mail", 'wpad');
        ?>
</a> ) :</td>

					<td><?php 
        echo $results[0]['comment_author_email'];
        ?>
</td>

				</tr>

				<tr>

					<td class="first">

					<?php 
        _e("Comment :", 'wpad');
        ?>
</td>

					<td><p><?php 
        echo $results[0]['comment_content'];
        ?>
</p></td>

				</tr>

				<tr>

					<td class="first">

						<?php 
        _e("IP Address :", 'wpad');
        ?>
 

					</td>

					<td>

						<a href="http://whois.arin.net/rest/ip/<?php 
        echo $results[0]['comment_author_IP'];
        ?>
">

							<?php 
        echo $results[0]['comment_author_IP'];
        ?>

						</a>

					</td>

				</tr>

				<tr>

					<td class="first">

					<?php 
        _e("Submitted On :", 'wpad');
        ?>
</td>

					<td><p><?php 
        echo date('M d, Y \\a\\t g:i A', strtotime($results[0]['comment_date']));
        ?>
</p></td>

				</tr>

				<?php 
        if ($results[0]['comment_parent'] != 0) {
            ?>

					<tr>

						<td class="first"><?php 
            _e("In Reply To :", 'wpad');
            ?>
</td>

						<td><a href="#"><?php 
            echo get_comment_author($results[0]['comment_parent']);
            ?>
</a></td>

					</tr>

					<?php 
        }
        ?>

			</tbody>

		</table>

		<?php 
    }
<?php

/*
** If comments_template() tag is used then it will replace that with this.
*/
$wpad_frontend_comment_form = new wpad_frontend_comment_form();
$id = $wpad_frontend_comment_form->get_the_selected_comment_form();
echo do_shortcode('[wpad-comment-form id="' . $id . '"]');
    function get_wpad_comments()
    {
        $page_no = empty($_POST['page']) ? '0' : $_POST['page'];
        $range = 10;
        if ($page_no == 0 || $page_no == 1) {
            $page_no = 0;
        } else {
            $page_no = ($page_no - 1) * $range;
        }
        $comment_status = !empty($_POST['comment_status']) ? $_POST['comment_status'] : '';
        $order = !empty($_POST['comment_order']) && $_POST['comment_order'] != 'all' ? $_POST['comment_order'] : 'DESC';
        $comment_order_by = !empty($_POST['comment_order_by']) && $_POST['comment_order_by'] != 'all' ? $_POST['comment_order_by'] : 'comment_author';
        $comment_post = !empty($_POST['comment_post']) && $_POST['comment_post'] != 'all' ? $_POST['comment_post'] : 0;
        $comment_user = !empty($_POST['comment_user']) && $_POST['comment_user'] != 'all' ? $_POST['comment_user'] : '';
        $args = array('order' => $order, 'status' => $comment_status, 'number' => $range, 'orderby' => $comment_order_by, 'offset' => $page_no, 'post_id' => $comment_post, 'user_id' => $comment_user);
        if ($comment_user == 'guest') {
            $ids = $this->get_all_user_ids();
            $args['author__not_in'] = $ids;
        }
        $comments = get_comments($args);
        $content = '';
        if (!empty($comments)) {
            foreach ($comments as $value) {
                $status_class = $this->comment_status_class($value, $comment_status);
                ob_start();
                ?>

				<tr class="<?php 
                echo $status_class;
                ?>
">

					<th class="check-column" scope="row">		

						<input type="checkbox" value="<?php 
                echo $value->comment_ID;
                ?>
" name="check_ids">

					</th>

					<td class="author column-author">

						<strong>

							<?php 
                $comment_form = new wpad_frontend_comment_form();
                $option = get_option('wpad_comment_form');
                $commnet_form_id = get_comment_meta($value->comment_ID, 'wpad_comment_form_id', true);
                $form_ids = !empty($option[$commnet_form_id]) ? $option[$commnet_form_id] : '';
                $object = $this->get_comment_in_array($value->comment_ID);
                echo $comment_form->validate_gravatar($value->comment_author_email, $form_ids, $object, 32);
                ?>

							<?php 
                echo $value->comment_author;
                ?>

						</strong>

						<br>

						<a href="mailto:<?php 
                echo $value->comment_author_email;
                ?>
">

							<?php 
                echo $value->comment_author_email;
                ?>

						</a>

						<br>	

						<?php 
                echo $value->comment_author_IP;
                ?>

					</td>

					<td class="comment column-comment">

						<div class="submitted-on">

							<?php 
                _e("Submitted on", 'wpad');
                ?>
 

							<?php 
                $post_link = $this->get_comment_link($value->comment_post_ID, $value->comment_ID);
                ?>

							<a href="<?php 
                echo $post_link;
                ?>
" target="blank" >

								<?php 
                echo date('d M, Y \\a\\t g:i a', strtotime($value->comment_date_gmt));
                ?>

							</a> 

							<?php 
                $this->reply_to($value->comment_parent, $post_link);
                ?>

						</div>

						<p><?php 
                echo $value->comment_content;
                ?>
</p>

						<div class="row-actions">

							<?php 
                if ($comment_status == 'all' || $comment_status == '' || $comment_status == 'hold' || $comment_status == 'approve') {
                    $this->row_action_pending_all($value);
                } elseif ($comment_status == 'spam') {
                    $this->row_action_spam($value);
                } elseif ($comment_status == 'trash') {
                    $this->row_action_trash($value);
                }
                $this->reset_flagged_reports($value->comment_ID);
                ?>

						</div>

					</td>

					<td class="response column-response">

						<div class="response-links">

							<span class="post-com-count-wrapper">

								<a href="<?php 
                echo get_edit_post_link($value->comment_post_ID);
                ?>
" class="comments-edit-item-link">

									<?php 
                echo get_the_title($value->comment_post_ID);
                ?>
 

								</a>

								<?php 
                $this->view_page($value->comment_post_ID);
                ?>

								<span class="post-com-count-wrapper">

									<a class="post-com-count post-com-count-approved" href="javascript:void(0)">

										<span class="comment-count-approved"><?php 
                $this->comment_count($value->comment_post_ID);
                ?>
</span>

									</a>

								</span>

							</span> 
							
						</div>

					</td>

					<td class="wpad_count_reported">
			
						<?php 
                $this->count_reported($value->comment_ID, $value->comment_post_ID);
                ?>
					
					</td>

				</tr>

				<?php 
                $content .= ob_get_clean();
            }
            $total_comments = $this->count_total_comments($args, $_POST['page']);
        } else {
            $content = '<tr><td colspan="4">' . __("No comments found.", 'wpad') . '</td></tr>';
            $total_comments = '';
        }
        $data = array('content' => $content, 'status' => $this->get_comments_status(), 'pagination' => $total_comments, 'showing_results' => $this->showing_results($comment_status, $comment_user, $comment_post, $comment_order_by, $order));
        echo json_encode($data);
        die;
    }