diff --git a/ext/pm/theme.php b/ext/pm/theme.php
index bb1e8346..22088fa0 100644
--- a/ext/pm/theme.php
+++ b/ext/pm/theme.php
@@ -6,6 +6,8 @@ class PrivMsgTheme extends Themelet
{
global $user;
+ $user_cache = [];
+
$html = "
R? | Subject | From | Date | Action |
@@ -15,13 +17,18 @@ class PrivMsgTheme extends Themelet
if (strlen(trim($h_subject)) == 0) {
$h_subject = "(No subject)";
}
- $from = User::by_id($pm->from_id);
+ if (!array_key_exists($pm->from_id, $user_cache)) {
+ $from = User::by_id($pm->from_id);
+ $user_cache[$pm->from_id] = $from;
+ } else {
+ $from = $user_cache[$pm->from_id];
+ }
$from_name = $from->name;
$h_from = html_escape($from_name);
$from_url = make_link("user/".url_escape($from_name));
$pm_url = make_link("pm/read/".$pm->id);
$del_url = make_link("pm/delete");
- $h_date = html_escape($pm->sent_date);
+ $h_date = substr(html_escape($pm->sent_date), 0, 16);
$readYN = "Y";
if (!$pm->is_read) {
$h_subject = "$h_subject";
@@ -31,7 +38,8 @@ class PrivMsgTheme extends Themelet
$html .= "
$readYN |
$h_subject |
- $h_from | $h_date |
+ $h_from |
+ $h_date |
|