Fix profile.php errors.
This commit is contained in:
parent
63f0f4f6ba
commit
b26ecb0d68
2 changed files with 24 additions and 2 deletions
|
@ -3,7 +3,14 @@ use Misuzu\Users\User;
|
|||
|
||||
require_once __DIR__ . '/../misuzu.php';
|
||||
|
||||
$user_id = (int)$_GET['u'];
|
||||
$user_id = (int)($_GET['u'] ?? 0);
|
||||
|
||||
try {
|
||||
$app->templating->vars(['profile' => User::findOrFail($user_id)]);
|
||||
} catch (Exception $ex) {
|
||||
http_response_code(404);
|
||||
echo $app->templating->render('user.notfound');
|
||||
return;
|
||||
}
|
||||
|
||||
$app->templating->vars(['profile' => User::findOrFail($user_id)]);
|
||||
echo $app->templating->render('user.view');
|
||||
|
|
15
views/mio/user/notfound.twig
Normal file
15
views/mio/user/notfound.twig
Normal file
|
@ -0,0 +1,15 @@
|
|||
{% extends '@mio/user/master.twig' %}
|
||||
{% from '@mio/macros.twig' import navigation %}
|
||||
|
||||
{% set title = 'User not found!' %}
|
||||
|
||||
{% block content %}
|
||||
<div class="mio__container">
|
||||
<div class="mio__container__title">User not found!</div>
|
||||
<div class="mio__container__content">
|
||||
<p>Check the url and try again.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ navigation(mio_navigation, false) }}
|
||||
{% endblock %}
|
Loading…
Add table
Reference in a new issue