{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>
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');
}
/**
- * 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;