Friday, February 24, 2012

Remove the recently modified link in Quick Launch

In SharePoint 2010 we all are familiar with the following annoying quicklaunch menu:
In SharePoint 2010, the recently modified items is one of many less-used feature. In software industry we are familiar with 80-20 principal. If 80% custom wants a feature then we should go with it and if you can satisfy 80% users then you have the successful product. I guess the ‘Recently Modified’ quick link doesn’t even needed by 10% people but the link is enable by default. Maybe this is a security feature to let administrator know what files have been modified recently. But there should have an on/off option as this is less wanted feature and most of the administrators want to hide this link. Justin has already found a way to hide the option by modifying template file as described in his blog. However, we can fix the issue without modifying the shared file. Specially in case of shared hosting we don’t want to modify the files from 14 hive. The two approaches described here is implemented by modifying master page. The first approach is acceptable but may have unknown side effects. On the other hand second approach is much better and less chance of side effects.

First solution:

1. Open your master page (default one is V4.master) and find the content place holder ‘PlaceHolderLeftActions’ as shown below:
<asp:ContentPlaceHolder id="PlaceHolderLeftActions" runat="server">                
2. Now set the content place holder visible property to false. as shown below:
<asp:ContentPlaceHolder id="PlaceHolderLeftActions" runat="server" Visible="false">            

Why it works?
The above trick works as in the aspx files the recently changed menu is put inside the placeholder. If you open a file in SharePoint Designer you can find that the recently modified menu is put under the placeholder with id ‘PlaceHolderLeftActions’ as shown below:
<asp:Content ContentPlaceHolderId="PlaceHolderLeftActions" runat="server">
    <SharePoint:RecentChangesMenu runat="server" id="RecentChanges" />

The content placeholder ‘PlaceHolderLeftActions’ mainly used in blog and wiki sites. So if you are using any of this kind of template then hiding the content place holder will hide others related links too. However, I have found that hiding the content placeholder in team site works perfectly.

Second and Better Solution

However, the above trick may have side effects, if the same place holder (‘PlaceHolderLeftActions’) is used by other pages. Another solution (which I think less side effects or no side effects) is to apply a css. As shown in the following screen, the ‘recently modified’ quick launch uses a css class named ‘s4-recentchanges’ (shown with firebug).
So we can another property ‘display:none’ to the same css class by adding the following extra attribute to master page’s header section:
<style type="text/css">
You can even put the above section in a css file and refer the file in master page. The following image shows the master page with the css class:


1 comment:

  1. The CSS addition works like a charm but it's a bit of a hack. Can you provide steps for modifying the existing site CSS file rather than adding extra code to the template?