diff --git a/ext/comment/main.php b/ext/comment/main.php index 8db00042..7d16f70a 100644 --- a/ext/comment/main.php +++ b/ext/comment/main.php @@ -178,16 +178,15 @@ class CommentList extends Extension { $this->build_page($page_num); } else if($event->get_arg(0) === "beta-search") { - $i_comment_count = Comment::count_comments_by_user($user); - $com_per_page = 50; - $total_pages = ceil($i_comment_count/$com_per_page); $search = $event->get_arg(1); $page_num = int_escape($event->get_arg(2)); - $page_num = $this->sanity_check_pagenumber($page_num, $total_pages); $duser = User::by_name($search); - + $i_comment_count = Comment::count_comments_by_user($duser); + $com_per_page = 50; + $total_pages = ceil($i_comment_count/$com_per_page); + $page_num = $this->sanity_check_pagenumber($page_num, $total_pages); $comments = $this->get_user_comments($duser->id, $com_per_page, ($page_num-1) * $com_per_page); - $this->theme->display_all_user_comments($comments, $page_num, $total_pages); + $this->theme->display_all_user_comments($comments, $page_num, $total_pages, $duser); } } } diff --git a/ext/comment/theme.php b/ext/comment/theme.php index 9e644033..fe6916b1 100644 --- a/ext/comment/theme.php +++ b/ext/comment/theme.php @@ -170,8 +170,8 @@ class CommentListTheme extends Themelet { $page->add_block(new Block("Comments", $html, "left", 70, "comment-list-user")); } - public function display_all_user_comments($comments, $page_number, $total_pages) { - global $page, $user; + public function display_all_user_comments($comments, $page_number, $total_pages, $user) { + global $page; assert(is_numeric($page_number)); assert(is_numeric($total_pages)); @@ -199,7 +199,7 @@ class CommentListTheme extends Themelet { $h_next = ($page_number >= $total_pages) ? "Next" : "Next"; $page->add_block(new Block("Navigation", $h_prev.' | '.$h_index.' | '.$h_next, "left", 0)); - $this->display_paginator($page, 'comment/beta-search/'.$user->name, null, $page_number, $total_pages); + $this->display_paginator($page, "comment/beta-search/{$user->name}", null, $page_number, $total_pages); } protected function comment_to_html($comment, $trim=false) {