Skip to content

Commit

Permalink
Bugfix #34
Browse files Browse the repository at this point in the history
- Closes issue #34
- Add an option to return to the previous page - in case of issues, server root
  • Loading branch information
RustyBraze committed Sep 7, 2024
1 parent a7fbd3a commit d3b257c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion resources/views/admin/user/edit-goodie.twig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{% block content %}
<div class="container">
<h1>
{{ m.back(url('/admin-active')) }}
{{ m.back(url(previousUrl)) }}
{{ block('title') }}: <small>{{ m.user(userdata) }}</small>
</h1>

Expand Down
4 changes: 4 additions & 0 deletions src/Controllers/Admin/UserGoodieController.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,15 @@ public function editGoodie(Request $request): Response

$user = $this->user->findOrFail($userId);

// Get the previous page URL (referrer)
$previousUrl = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/';

return $this->response->withView(
'admin/user/edit-goodie.twig',
[
'userdata' => $user,
'is_tshirt' => $this->config->get('goodie_type') === GoodieType::Tshirt->value,
'previousUrl' => $previousUrl
]
);
}
Expand Down

0 comments on commit d3b257c

Please sign in to comment.