Things were fetched from the currently logged user instead of the viewed one. My bad.
This commit is contained in:
parent
31cfb00b15
commit
ef8c60f032
2 changed files with 8 additions and 9 deletions
|
@ -178,16 +178,15 @@ class CommentList extends Extension {
|
||||||
$this->build_page($page_num);
|
$this->build_page($page_num);
|
||||||
}
|
}
|
||||||
else if($event->get_arg(0) === "beta-search") {
|
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);
|
$search = $event->get_arg(1);
|
||||||
$page_num = int_escape($event->get_arg(2));
|
$page_num = int_escape($event->get_arg(2));
|
||||||
$page_num = $this->sanity_check_pagenumber($page_num, $total_pages);
|
|
||||||
$duser = User::by_name($search);
|
$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);
|
$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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,8 +170,8 @@ class CommentListTheme extends Themelet {
|
||||||
$page->add_block(new Block("Comments", $html, "left", 70, "comment-list-user"));
|
$page->add_block(new Block("Comments", $html, "left", 70, "comment-list-user"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function display_all_user_comments($comments, $page_number, $total_pages) {
|
public function display_all_user_comments($comments, $page_number, $total_pages, $user) {
|
||||||
global $page, $user;
|
global $page;
|
||||||
|
|
||||||
assert(is_numeric($page_number));
|
assert(is_numeric($page_number));
|
||||||
assert(is_numeric($total_pages));
|
assert(is_numeric($total_pages));
|
||||||
|
@ -199,7 +199,7 @@ class CommentListTheme extends Themelet {
|
||||||
$h_next = ($page_number >= $total_pages) ? "Next" : "<a href='$next'>Next</a>";
|
$h_next = ($page_number >= $total_pages) ? "Next" : "<a href='$next'>Next</a>";
|
||||||
|
|
||||||
$page->add_block(new Block("Navigation", $h_prev.' | '.$h_index.' | '.$h_next, "left", 0));
|
$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) {
|
protected function comment_to_html($comment, $trim=false) {
|
||||||
|
|
Reference in a new issue