<?php
/********用户资料页面********/
if(!is_user_logged_in()) {
	wp_redirect(site_url()."/wp-login.php");
	exit;
}
global $wpdb, $post, $wp_query,$current_user,$userdata;
get_currentuserinfo();
$query_vars = $wp_query->query_vars;
//$pagenum = isset($query_vars['paged']) ? $query_vars['paged'] : 1;
$pagenum = isset( $_GET['pagenum'] ) ? intval( $_GET['pagenum'] ) : 1;
$comments_total = get_user_comments_count($userdata->ID);
$total_page = ceil($comments_total/20);
$current = ($pagenum-1)*20;
$args = array(
	'user_id' => get_current_user_id(),
	'status' => 'approve',
	'number' => 20,
	'offset' => $current
);
$coments_query = get_comments( $args );
?>
<h2>评论总数：<?php echo $comments_total;?></h2>
<ul class="item-list">
<?php wp_list_comments( array('callback'=>'user_comments_list'), $coments_query );?>
</ul>
<?php
$pagination = paginate_links( array(
	'base' => add_query_arg( 'pagenum', '%#%' ),
	'format' => '',
	'prev_text' => '上一页',
	'next_text' => '下一页',
	'total' => $total_page,
	'current' => $pagenum
	)
);
if ( $pagination ) {
	echo $pagination;
}
?>