summaryrefslogtreecommitdiff
path: root/src/application/actions/lookupuser/get.php
blob: ca6c6f30f29db9590b34dbbbdc5b8a27aeb9f93d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php

use mystic\forum\orm\User;

$userHandle = $_GET["handle"] ?? throw new Exception("Missing handle");

$user = new User();
$user->name = $userHandle;

if (!$db->fetchWhere($user, "name")) {
    http_response_code(404);
    msg_error(__("No user with name @%user_handle%", [ "user_handle" => $userHandle ]));
    exit;
}

header("Location: ./?_action=viewuser&user=" . urlencode($user->id));