Resolved conflicts
authorMarcel Werk <burntime@woltlab.com>
Fri, 1 Jul 2016 15:08:11 +0000 (17:08 +0200)
committerMarcel Werk <burntime@woltlab.com>
Fri, 1 Jul 2016 15:08:11 +0000 (17:08 +0200)
com.woltlab.wcf/templates/user.tpl
wcfsetup/install/files/lib/page/UserPage.class.php
wcfsetup/install/files/lib/system/menu/user/profile/UserProfileMenu.class.php

index c6484b8614ce462b22c1bba057504bfb4168891c..e42729dfd0c14157db55b63253a4a575515f65b8 100644 (file)
 {include file='header'}
 
 {if !$user->isProtected()}
-       <div id="profileContent" class="section tabMenuContainer userProfileContent" data-active="{$__wcf->getUserProfileMenu()->getActiveMenuItem()->getIdentifier()}">
+       <div id="profileContent" class="section tabMenuContainer userProfileContent" data-active="{$__wcf->getUserProfileMenu()->getActiveMenuItem($userID)->getIdentifier()}">
                <nav class="tabMenu">
                        <ul>
                                {foreach from=$__wcf->getUserProfileMenu()->getMenuItems() item=menuItem}
                {foreach from=$__wcf->getUserProfileMenu()->getMenuItems() item=menuItem}
                        {if $menuItem->getContentManager()->isVisible($userID)}
                                <div id="{$menuItem->getIdentifier()}" class="tabMenuContent" data-menu-item="{$menuItem->menuItem}">
-                                       {if $menuItem === $__wcf->getUserProfileMenu()->getActiveMenuItem()}
+                                       {if $menuItem === $__wcf->getUserProfileMenu()->getActiveMenuItem($userID)}
                                                {@$profileContent}
                                        {/if}
                                </div>
index 562017a287c729cd9cd0f11f5a4318a2115ca9d7..ec048f5c2cf332ecdced37247af6a43cc9c8b313 100644 (file)
@@ -111,7 +111,7 @@ class UserPage extends AbstractPage {
                        UserProfileMenu::getInstance()->setActiveMenuItem('about');
                }
                
-               $activeMenuItem = UserProfileMenu::getInstance()->getActiveMenuItem();
+               $activeMenuItem = UserProfileMenu::getInstance()->getActiveMenuItem($this->user->userID);
                $contentManager = $activeMenuItem->getContentManager();
                $this->profileContent = $contentManager->getContent($this->user->userID);
                $this->objectType = ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.user.profileEditableContent', 'com.woltlab.wcf.user.profileAbout');
index 6c65c2eb0d8d497c88c8c802d2fdc02164f14658..03ad912b6241c46eee099f87fc08950f40ce3f88 100644 (file)
@@ -99,18 +99,28 @@ class UserProfileMenu extends SingletonFactory {
        }
        
        /**
-        * Returns the first menu item.
+        * Returns the first visible menu item.
         * 
+        * @param       integer         $userID
         * @return      UserProfileMenuItem
         */
-       public function getActiveMenuItem() {
+       public function getActiveMenuItem($userID = 0) {
                if (empty($this->menuItems)) {
                        return null;
                }
                
                if ($this->activeMenuItem === null) {
-                       reset($this->menuItems);
-                       $this->activeMenuItem = current($this->menuItems);
+                       if (!empty($userID)) {
+                               foreach ($this->menuItems as $menuItem) {
+                                       if ($menuItem->getContentManager()->isVisible($userID)) {
+                                               $this->activeMenuItem = $menuItem;
+                                               break;
+                                       }
+                               }
+                       }
+                       else {
+                               $this->activeMenuItem = reset($this->menuItems);
+                       }
                }
                
                return $this->activeMenuItem;