Tag Archives: SPD

Hiding status bar messages in SharePoint 2010

Often times, we may need to make changes to master page files in a SharePoint site to customize a layout, add styling, CSS, custom web parts, etc.  When the site was created using a default site template and content type, and your changes deviate from this, as you save you’ll be prompted with a warning basically saying “you do realize this is different from the original template, right?”.  However, when you open the page in a browser, your users will have a status bar at the top with an option to “Revert to Site Template”, which will re-render the page and possibly remove the changes you’ve made, giving them the idea they weren’t done or done right.

This is an easy solution, which @ranaictiu mentioned in his blog post here.

Basically, open the site in SPD and open up the V4.master file in Master Pages.  Locate the following section of code:


<div id="s4-statusbarcontainer">
<div id="pageStatusBar" class="s4-status-s1"></div>
</div>

add the following style attribute to the first DIV:

<div id="s4-statusbarcontainer" style="display: none">
<div id="pageStatusBar">
</div>
</div>

This will hide all status bar notifications going forward.  Now, if you want to show some status bar messages but just hide others a script like the following would handle that (put it in the <head> area of the master page):

<script type="text/javascript">
ExecuteOrDelayUntilScriptLoaded(hideWarning, "sp.js");
function hideWarning(){
var statusBarContainer = document.getElementById('s4-statusbarcontainer');
if(statusBarContainer != null){
var messageSpan = document.getElementById('status_1_body');
if(messageSpan != null){
if(messageSpan.innerHTML.indexOf('The current page has been customized from its template.') == -1
statusBarContainer.style.display = 'inline';
}
}
}
</script>

Hope this helps!

 

Eric Oszakiewski

Eric Oszakiewski is a professional software developer based in Scottsdale, AZ with over 37 years of IT experience, and 19 years Native American Gaming experience. He is currently working as a .Net/SharePoint Development Lead for General Motors.

More Posts - Website

Follow Me:
TwitterFacebookLinkedInYouTube