Skip to content

Commit

Permalink
Merge pull request #7947 from Oldiesmann/fixpms
Browse files Browse the repository at this point in the history
Fix some PM bugs
  • Loading branch information
Sesquipedalian authored Dec 24, 2023
2 parents a53850e + 51da0a4 commit 8443986
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
5 changes: 2 additions & 3 deletions Sources/PersonalMessage/PM.php
Original file line number Diff line number Diff line change
Expand Up @@ -531,9 +531,8 @@ public static function get($ids, array $query_customizations = [])
$limit = $query_customizations['limit'] ?? count($ids);
$params = $query_customizations['params'] ?? [];

if (!empty($ids)) {
$params['ids'] = array_filter(array_unique(array_map('intval', $ids)));
}
// There will never be an ID 0, but SMF doesn't like empty arrays when you tell it to expect an array of integers...
$params['ids'] = empty($ids) ? [0] : array_filter(array_unique(array_map('intval', $ids)));

foreach(self::queryData($selects, $params, $joins, $where, $order, $group, $limit) as $row) {
$id = (int) $row['id_pm'];
Expand Down
2 changes: 1 addition & 1 deletion Sources/PersonalMessage/Popup.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function show(): void
}

// Now, actually fetch me some PMs.
foreach (PM::load($pms, false) as $pm) {
foreach (PM::load($pms) as $pm) {
// Make sure we track the senders. We have some work to do for them.
if (!empty($pm->member_from)) {
$senders[] = $pm->member_from;
Expand Down
2 changes: 2 additions & 0 deletions Sources/PersonalMessage/Received.php
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,8 @@ public static function getRecent(int $label = -1, string $sort = 'pmr.id_pm', bo
return self::$recent[$paramskey];
}

self::$recent[$paramskey] = [];

$joins = [];

$where = [
Expand Down
2 changes: 1 addition & 1 deletion Sources/PersonalMessage/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ public function performSearch(): void
// Sort out the page index.
Utils::$context['page_index'] = new PageIndex(
Config::$scripturl . '?action=pm;sa=search2;params=' . $this->compressed_params,
$_GET['start'],
(int) ($_GET['start'] ?? 0),
Utils::$context['num_results'],
$this->per_page,
false,
Expand Down

0 comments on commit 8443986

Please sign in to comment.