-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathUser.php
More file actions
44 lines (34 loc) · 1.03 KB
/
Copy pathUser.php
File metadata and controls
44 lines (34 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
/**
* Copyright (C) 2015-2019 FeatherBB
* based on code by (C) 2008-2015 FluxBB
* and Rickard Andersson (C) 2002-2008 PunBB
* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
*/
namespace FeatherBB\Model\Api;
use FeatherBB\Core\Error;
use FeatherBB\Core\Interfaces\Hooks;
class User extends Api
{
public function display($id)
{
$user = new \FeatherBB\Model\Profile();
// Remove sensitive fields for regular users
if (!$this->isAdMod) {
Hooks::bind('model.profile.get_user_info', function ($user) {
$user = $user->selectDeleteMany(['u.email', 'u.registration_ip', 'u.auto_notify', 'u.admin_note', 'u.last_visit']);
return $user;
});
}
try {
$data = $user->getUserInfo($id);
} catch (Error $e) {
return $this->errorMessage;
}
$data = $data->asArray();
if (!$this->isAdMod) {
unset($data['prefs']);
}
return $data;
}
}