@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3abstract class PhabricatorPeopleController extends PhabricatorController {
4
5 public function shouldRequireAdmin() {
6 return true;
7 }
8
9 /**
10 * return AphrontSideNavFilterView
11 */
12 public function buildSideNavView($for_app = false) {
13 // we are on /people/*
14 $nav = new AphrontSideNavFilterView();
15 $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
16
17 $viewer = $this->getRequest()->getUser();
18 id(new PhabricatorPeopleSearchEngine())
19 ->setViewer($viewer)
20 ->addNavigationItems($nav->getMenu());
21
22 if ($viewer->getIsAdmin()) {
23 $nav->addLabel(pht('User Administration'));
24 $nav->addFilter('logs', pht('Activity Logs'));
25 }
26
27 $can_invite = $this->hasApplicationCapability(
28 PeopleCreateUsersCapability::CAPABILITY);
29
30 if ($can_invite) {
31 $nav->addFilter('invite', pht('Email Invitations'));
32 }
33
34 return $nav;
35 }
36
37 public function buildApplicationMenu() {
38 if ($this->getRequest()->getURIData('username')) {
39 // we are on /p/name/ so return the default user profile sidebar
40 return parent::buildApplicationMenu();
41 }
42 return $this->buildSideNavView(true)->getMenu();
43 }
44
45}