Prevent theme inheritance on Publishing sub-sites


If you’ve created publishing sites and then tried changing the theme on a sub-site, you’ve probably run into this issue:

You apply the theme and nothing changes!!!!!

For some reason or another, when Publishing features are enabled; sub-sites inherit the theme from their parent site. You can prevent this from happening by doing the following:

Open up the default master page for the site in SharePoint Designer and look for the following tag:

<meta name="Microsoft Theme" content="<Theme Name> 1011, default">

Either delete or comment-out this tag and then save your master page, you should no longer have this issue.

Customize Search Box


Ever wanted to make the Search Box in SharePoint a little less, um, boring?

Well then I have some good news, you can make it pretty cool with a few minutes of time for both configuration and branding.

First things first, you have to make a small addition to your default master page. Open the master page in SharePoint Designer and add the following entry at the top:

<%@ Register TagPrefix="SPSWC" Namespace="Microsoft.SharePoint.Portal.WebControls" Assembly="Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

After that’s done, don’t leave your master page just yet, do a Ctrl+F and search for “PlaceHolderSearchArea” to find the current search box. You’re going to want to take the following chunk of code and place it into a hidden ASP panel:

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

Note: Don’t forget that last “/”, or you will get errors when saving the master page.

Here’s how the chunk of code should look once it’s in the hidden panel, note that I placed mine right above the closing BODY and HTML tags.

<!--HIDDEN SEARCH INPUT-->
<asp:Panel visible="false" runat="server">
<asp:ContentPlaceHolder id="PlaceHolderSearchArea" runat="server"/>
</asp:Panel>
<!--HIDDEN SEARCH INPUT-->

(I add comments to everything so I can always re-trace my steps)

Once that’s done, you should have a hidden search box if you view the Design mode screen. Now is the time to add the new search box. Here’s the chunk of code required for that action:

<!--ADD SEARCH HERE-->
<div id="searchLayout">
<SPSWC:SearchBoxEx id="SearchBox" RegisterStyles="false" QueryPromptString="Search This Site" TextBeforeTextBox="" TextBoxWidth="200" GoImageUrl="" GoImageActiveUrl="" GoImageUrlRTL="" GoImageActiveUrlRTL="" UseSiteDefaults="true" DropDownMode="HideScopeDD" SuppressWebPartChrome="true" runat="server" WebPart="true" __WebPartId="{0043945F-2D2B-4A02-8510-CED13B6F04DF}"/>
</div>

You may notice I have “Search This Site” under the QueryPromptString tag; this is so I can see “Search This Site” in my search box once my search box customization is complete. You can put anything you want here, or if you prefer a blank box, leave it blank.

Once I save my master page, I now have a pretty blank (border only) search box with “Search This Site” inside. Now is the time to brand it a little with some CSS…

In my custom style sheet, I added the following to make mine pretty:

#searchLayout input {
background:transparent;
background-image:url("magGlass.png"); 
background-repeat:no-repeat; 
padding-left:20px;
}
td.ms-sbcell{
background-position:0px -100px;
padding:0px;
padding-left:5px;
white-space:nowrap;
border:solid 1px #990099;
}

Note: I made a little magnifying glass image to put inside the box. Mine is called magGlass.png, and I set the padding to 20px to push the text to the right of my magnifying glass image. Here’s the finished product:

Add Flyout/Dropdown Functionality to Quick Launch Menu


Have you wondered how you can get the Quick Launch to display fly out menus, similar to the Top-Link bar drop-down menus? It can be done with just a few small tweaks to the Master Page.

If you open up your default master page in SharePoint Designer and search for the following block, this is where you’ll edit:

<asp:AspMenu
  id="QuickLaunchMenu"
  DataSourceId="QuickLaunchSiteMap"
  runat="server"
  Orientation="Vertical"
  StaticDisplayLevels="1"
  ItemWrap="true"
  MaximumDynamicDisplayLevels="1"
  StaticSubMenuIndent="0"
  SkipLinkText=""
>

By default, the highlighted portions are set to “2” and “0” respectively, by setting them to “1” it gives us the fly out functionality we were looking for, pretty cool!

The problem I ran into after getting this to work is the “fly out” container consists of a white background; no border and it seemed to inherit the font-color from my custom style sheet. That’s fine, or so I thought. Being that the background of my site is also white, it made it very difficult to see the fly out menu easily. I thought I could easily set the background via the CSS sheet like anything else, boy was I wrong!

After some searching, I found several people with the same problem and no easy fix; until I came across an MSDN article. Basically it showed that by applying the Tag to the SharePoint:AspMenu portion of the master page you could apply formatting to the “fly out”.

So I added that and at first I was following a blog post that said you could use something like to apply styles to the menu, I tried that and could not get it to work so I instead used the MSDN article and applied the formatting directly in the master page, and then I coordinated it with the CSS sheet to make sure the styles matched. Here is my DynamicMenuStyle code chunk after formatting:

<DynamicMenuStyle

      backcolor="#FFFFFF"

      forecolor="#0066cc"

      borderstyle="Solid"

      borderwidth="2"

      bordercolor="#0066cc"

/>

After doing that I now have working, branded fly out functionality for both the Top Link Bar and Quick Launch Bars on my MOSS site.

Get Rid of “Welcome System Account”


If you’ve deployed SharePoint before, whether in an Enterprise farm or on your Windows XP laptop in a Virtual Machine; if you still login using the account you installed SharePoint with (Local Administrator for example) you’ve probably noticed that the Welcome menu thinks your name is “System Account.”

Whether or not you use the same account you installed SharePoint with as an Application Pool Identity account in IIS is irrelevant, if you installed SharePoint using an account-and you use that account for administration, than it will assume you’re a System Account. I assume this is written somewhere in the Configuration database, but looking would be a big no-no.

However, just because SharePoint thinks that you’re a “System Account” doesn’t mean you have to look at that generic Welcome message each and every time you login to one of your SharePoint sites. In order to get rid of this behavior, a simple use of the stsadm -o updatefarmcredentials command is necessary.

However, before we get to that, let’s make sure that the desired name is entered how we want to see it in the Shared Services Provider-User Profiles and Properties area.

1. Open up Central Administration for your SharePoint farm and click on the Shared Services Provider link to get to your SSP Site.

2. Click on “User Profiles and Properties”

3. Click on “View User Profiles”

4. Hover over the profile you wish to edit and select Edit. Note: In my case I was using the Local Administrator account.

5. The third editable field should be “Name:” enter the name as you wish it to be displayed, for my Virtual machine I used my name, “Ryan Dennis.”

6. Click “Save and Close”

We can now move onto the fun part, updating our farm credentials!

Here’s how we do that:

1. Open a command prompt

2. Enter the following command:
stsadm –o updatefarmcredentials –identitytype configurableid –userlogin -password

3. You should see “Operation Completed Successfully”

4. Reset IIS
iisreset /noforce

Refresh the page and you should see “Welcome” wherematches the name you provided in the SSP Profiles and Properties page.