For those of you who might have noticed, the top navigation disappears when you’re viewing someone else’s profile using the Person.aspx page. This behavior seems very mysterious, considering the navigation appears on the other pages in the root “My Site” site collection.

I ran across this post on Bob Moore’s blog, where he describes how he disassembled the code and discovered that there’s code in Person.aspx that explicitly looks for the Content control that contains the top navigation, and then hides it! (“Oh Microsoft, why dost thou vex me so?!”) (You’ll need to scroll down the page to view his article called “You are not the person.aspx I thought you were!”)

Because the code is fairly “stupid” in the sense that it’s looking for placeholder controls with specific names (PlaceHolderTopNavBar, PlaceHolderHorizontalNav, and TopNavigationMenu), you can side-step this behavior by creating an alternative ContentPlaceHolder control in your Master Page that you can use in Person.aspx. Then, in Person.aspx, you’ll simply override the existing PlaceHolderTopNavBar placeholder from the Master Page, leaving it blank. (Although the custom code in Person.aspx will hide the top nav, it will leave the Site Actions menu, so if you don’t explicitly override the content placeholder control with empty content, you’ll get the Site Actions menu twice.)

For example, I added this control directly above the PceHolderTopNavBar ContentPlaceHolder control in my Master Page:

<asp:ContentPlaceHolder id="PlaceHolderTopNavBarPerson" runat="server"/>

As you can see, it’s an empty control, so it won’t display any markup on any of the existing My Site pages.

In the Person.aspx page, I added the following empty placeholder control to the page:

<asp:Content ContentPlaceHolderId="PlaceHolderTopNavBar" runat="server"/>

Then, I added my new control.

<asp:Content ContentPlaceHolderId="PlaceHolderTopNavBarPerson" runat="server"/>

I basically copied and pasted all the markup that’s inside the PlaceHolderTopNavBar ContentPlaceHolder control in the Master Page, (making sure to remove the <asp:ContentPlaceHolder id=”PlaceHolderHorizontalNav” runat=”server”> and </asp:ContentPlaceholder> tags that were embedded in it), and put that markup inside my new “PlaceHolderTopNavBarPerson” Content control.

Modifying actual “My Site” site collections for different users means you’re modifying multiple site collections, and it’s best to use a Feature Stapler. However, since Person.aspx is a singular page in the root My Site site collection, I don’t see any big problem with customizing Person.aspx from the original version, to add in the alternative Content controls.

If you’re already using a Feature to apply a custom Master Page to all your My Site site collections, there’s no reason why you couldn’t just add the additional ContentPlaceHolder control to your custom Master Page, and then activate your Feature in the root My Site site collection. Otherwise, you could easily modify the Master Page using SharePoint Designer in the root My Site site collection.

About Admin

Owner of Savvy Technical Solutions

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.