From 75842f03a5b80a8270bf44e9e39d5a4c6eb9b351 Mon Sep 17 00:00:00 2001 From: Jon Stovell Date: Tue, 14 May 2024 19:01:51 -0600 Subject: [PATCH] Fixes issues with moving boards Signed-off-by: Jon Stovell --- Languages/en_US/ManageBoards.php | 6 +++--- Sources/Board.php | 8 ++++---- Sources/Category.php | 3 +++ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Languages/en_US/ManageBoards.php b/Languages/en_US/ManageBoards.php index 044109c9bd..feb21dea37 100644 --- a/Languages/en_US/ManageBoards.php +++ b/Languages/en_US/ManageBoards.php @@ -71,9 +71,9 @@ $txt['mboards_current_redirects'] = 'Currently: {0, number, integer}'; $txt['mboards_order_first'] = 'In first place'; -$txt['mboards_order_before'] = 'Before "{0}"'; -$txt['mboards_order_after'] = 'After "{0}"'; -$txt['mboards_order_child_of'] = 'Sub-board of "{0}"'; +$txt['mboards_order_before'] = 'Before'; +$txt['mboards_order_after'] = 'After'; +$txt['mboards_order_child_of'] = 'Sub-board of'; $txt['mboards_order_in_category'] = 'In category'; $txt['mboards_current_position'] = 'Current Position'; $txt['no_valid_parent'] = 'Board {name} does not have a valid parent. Use the "find and repair errors" function to fix this.'; diff --git a/Sources/Board.php b/Sources/Board.php index fd118c0ce0..a0eefca31a 100644 --- a/Sources/Board.php +++ b/Sources/Board.php @@ -1600,16 +1600,16 @@ public static function modify(int $board_id, array &$boardOptions): void $board->member_groups = $boardOptions['access_groups'] ?? $board->member_groups; $board->deny_groups = $boardOptions['deny_groups'] ?? $board->deny_groups; - // We're ready to save the changes now. - $board->save($boardOptions); - - // If we moved any boards, save their changes too. + // If we moved any boards, save their changes first. if (!empty($moved_boards)) { foreach (array_diff($moved_boards, [$board->id]) as $moved) { self::$loaded[$moved]->save(); } } + // We're ready to save the changes now. + $board->save($boardOptions); + // Log the changes unless told otherwise. if (empty($boardOptions['dont_log'])) { Logging::logAction('edit_board', ['board' => $board->id], 'admin'); diff --git a/Sources/Category.php b/Sources/Category.php index cac5f93821..0865d16bd2 100644 --- a/Sources/Category.php +++ b/Sources/Category.php @@ -654,6 +654,8 @@ public static function getTreeOrder(): array */ public static function getTree(): void { + self::$loaded = []; + $selects = [ 'COALESCE(b.id_board, 0) AS id_board', 'b.name', 'b.description', 'b.id_parent', 'b.child_level', 'b.board_order', 'b.redirect', @@ -708,6 +710,7 @@ public static function getTree(): void $row['deny_member_groups'] = explode(',', $row['deny_member_groups']); $row['prev_board'] = $prevBoard; + unset(Board::$loaded[(int) $row['id_board']]); Board::init((int) $row['id_board'], $row); $prevBoard = $row['id_board'];