From 410c43d3a53262a916b646378e33882c39e7a31f Mon Sep 17 00:00:00 2001 From: Taiwen Date: Sat, 30 Aug 2014 16:25:18 +0800 Subject: [PATCH] Code cleaning --- usr/module/user/src/Api/Nav.php | 1 - usr/module/user/src/Controller/Front/ActivityController.php | 1 - usr/module/user/src/Controller/Front/ProfileController.php | 3 +++ usr/module/user/src/Registry/Activity.php | 2 +- usr/module/user/template/front/profile-topbar.phtml | 5 +++++ 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/usr/module/user/src/Api/Nav.php b/usr/module/user/src/Api/Nav.php index 6a24116e75..233bff1a6f 100755 --- a/usr/module/user/src/Api/Nav.php +++ b/usr/module/user/src/Api/Nav.php @@ -87,6 +87,5 @@ public function getList($cur, $uid = 0) } return $result; - } } \ No newline at end of file diff --git a/usr/module/user/src/Controller/Front/ActivityController.php b/usr/module/user/src/Controller/Front/ActivityController.php index 29dc1719a8..9637466efb 100755 --- a/usr/module/user/src/Controller/Front/ActivityController.php +++ b/usr/module/user/src/Controller/Front/ActivityController.php @@ -120,7 +120,6 @@ public function indexAction() //'quicklink' => $quicklink, //'owner' => $isOwner, )); - } /** diff --git a/usr/module/user/src/Controller/Front/ProfileController.php b/usr/module/user/src/Controller/Front/ProfileController.php index e3d9578181..0a9504af03 100644 --- a/usr/module/user/src/Controller/Front/ProfileController.php +++ b/usr/module/user/src/Controller/Front/ProfileController.php @@ -539,6 +539,9 @@ protected function getProfile($uid) $fields = Pi::registry('display_field', 'user')->read($gid); $list = array(); foreach ($fields as $field) { + if (!isset($meta[$field]['title'])) { + continue; + } $list[$field] = array( 'title' => $meta[$field]['title'], 'value' => isset($profile[$field]) ? $profile[$field] : '', diff --git a/usr/module/user/src/Registry/Activity.php b/usr/module/user/src/Registry/Activity.php index 4236dc69f5..8fa20f5e6a 100755 --- a/usr/module/user/src/Registry/Activity.php +++ b/usr/module/user/src/Registry/Activity.php @@ -38,7 +38,7 @@ protected function loadDynamic($options = array()) $list[$row['name']] = array( 'title' => $row['title'], 'description' => $row['description'], - //'module' => $row['module'], + 'module' => $row['module'], 'icon' => $row['icon'], 'callback' => $row['callback'], 'template' => $row['template'] diff --git a/usr/module/user/template/front/profile-topbar.phtml b/usr/module/user/template/front/profile-topbar.phtml index 1dec4140a0..c1535c418d 100644 --- a/usr/module/user/template/front/profile-topbar.phtml +++ b/usr/module/user/template/front/profile-topbar.phtml @@ -24,6 +24,11 @@ if (!$user) { return; } +// Check if the current visitor is owner of the user +if (!isset($owner)) { + $owner = !_get('uid') && $uid ? true : false; +} + // Load nav if ($owner) { $nav = Pi::api('nav', 'user')->getList($name);