- $cur = common_current_user();
- if (!empty($cur) && $cur->id == $profile->id) {
- $tagsub = new TagSub();
- $tagsub->profile_id = $profile->id;
- $entry = array(
- 'id' => 'tagsubs',
- 'label' => _m('Tag subscriptions'),
- 'link' => common_local_url('tagsubs', array('nickname' => $profile->nickname)),
- 'value' => $tagsub->count(),
- );
-
- $insertAt = count($stats);
- foreach ($stats as $i => $row) {
- if ($row['id'] == 'groups') {
- // Slip us in after them.
- $insertAt = $i + 1;
- break;
- }
+ $user = common_current_user();
+
+ if (!empty($user)) {
+
+ $tags = TagSub::forProfile($user->getProfile());
+
+ if (!empty($tags) && count($tags) > 0) {
+ $tagSubMenu = new TagSubMenu($menu->out, $user, $tags);
+ // TRANS: Menu item text for tags submenu.
+ $menu->submenu(_m('Tags'), $tagSubMenu);