summaryrefslogtreecommitdiff
path: root/src/application/actions/lookupuser/get.php
blob: 74143f42dc306a45f500b18bc99a647aae1f6a84 (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));