refer to users by name

This commit is contained in:
Shish 2019-12-15 15:40:15 +00:00
parent d705578f79
commit 09b9901493
3 changed files with 9 additions and 9 deletions

View file

@ -116,11 +116,11 @@ class ImageIO extends Extension
public function onUserPageBuilding(UserPageBuildingEvent $event)
{
$u_id = url_escape($event->display_user->id);
$i_image_count = Image::count_images(["user_id={$event->display_user->id}"]);
$u_name = url_escape($event->display_user->name);
$i_image_count = Image::count_images(["user={$event->display_user->name}"]);
$i_days_old = ((time() - strtotime($event->display_user->join_date)) / 86400) + 1;
$h_image_rate = sprintf("%.1f", ($i_image_count / $i_days_old));
$images_link = make_link("post/list/user_id=$u_id/1");
$images_link = make_link("post/list/user=$u_name/1");
$event->add_stats("<a href='$images_link'>Images uploaded</a>: $i_image_count, $h_image_rate per day");
}

View file

@ -31,11 +31,11 @@ class NumericScore extends Extension
$this->theme->get_nuller($event->display_user);
}
$u_id = url_escape($event->display_user->id);
$n_up = Image::count_images(["upvoted_by_id={$event->display_user->id}"]);
$link_up = make_link("post/list/upvoted_by_id=$u_id/1");
$n_down = Image::count_images(["downvoted_by_id={$event->display_user->id}"]);
$link_down = make_link("post/list/downvoted_by_id=$u_id/1");
$u_name = url_escape($event->display_user->name);
$n_up = Image::count_images(["upvoted_by={$event->display_user->name}"]);
$link_up = make_link("post/list/upvoted_by=$u_name/1");
$n_down = Image::count_images(["downvoted_by={$event->display_user->name}"]);
$link_down = make_link("post/list/downvoted_by=$u_name/1");
$event->add_stats("<a href='$link_up'>$n_up Upvotes</a> / <a href='$link_down'>$n_down Downvotes</a>");
}

View file

@ -33,7 +33,7 @@ class UserLinksColumn extends Column
}
public function display(array $row)
{
return A(["href"=>make_link("post/list/user_id={$row['id']}/1")], "Posts");
return A(["href"=>make_link("post/list/user={$row['name']}/1")], "Posts");
}
}