How to hide ribbon in SP2013 for some users? - sharepoint

how to hide the ribbon bar from anonymous user, Example for users that does not have managed web etc.

1) Open your SharePoint master page
2) Locate this line:
<div id="s4-ribbonrow" class="s4-pr s4-ribbonrowhidetitle">
3) Change it to:
<div id="s4-ribbonrow" class="s4-pr s4-ribbonrowhidetitle" style="display:none">
4) Now find the end of the “s4-ribbonrow” tag and add following block right after it:
<Sharepoint:SPSecurityTrimmedControl ID="SPSecurityTrimmedControl2" runat="server" PermissionsString="AddAndCustomizePages">
<script type="text/javascript">
document.getElementById("s4-ribbonrow").style.display = "block";
</script>
5) Save the new master page
OR
Add a LoginView control to the Sharepoint 2010 master page
Add AnonymousTemplate section to the LoginView Control
Place the entire SPRibbon control within the Anonymous template

Related

How can I get rid of the call to action button on my Weebly site?

I can't find any way to get rid of the call to action button on my landing page layout in Weebly. Is it possible to get rid of this button?
You need to perform two steps.
Remove the button from the desktop layout.
Open the layout file in HTML edit mode.
Remove the following line:
<div class="button-wrap">{action:button global="false"}</div>
Remove the button from the mobile layout.
Add the following script to the Header Code of the page:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js">
</script>
<script language='javascript'>
$(document).ready(function(){
$('.landing-container').remove();
});
</script>
You can see it in action on this site for gluten free products.

Change the subsite Logo URL IN SharePoint

I have created a main site and I have created many subsite under the main site.
When I am in any main page and click on the logo icon, the page redirects to the home page.
But, when I am in any subsite and click on the logo icon, the page redirects to the subsite homepage rather than the main hompage.
I would like to change the navigation URL to the root site. Let me know if I have to edit any masterpage, or is there any common page that will inherit to all the child application.
Thanks
We have 2 ways to do this.
Method 1:
From the Snippet Gallery, copy and paste the default SiteLogo code snippet into your master page into the appropriate place you want it to be displayed.
In the SiteLogo code, search for SharePoint:SPSimpleSiteLink to find the relevant opening and closing tags. Now simply change the tag names to SharePoint:SPLinkButton instead.
Then simply add the attribute NavigateUrl to this tag and set it’s value to “~sitecollection/”.
Example:
Default snippet code:
<!--MS:<SharePoint:SPSimpleSiteLink runat="server" CssClass="ms-siteicon-a" ID="x7917ecc8c38d4bd69f58e338eab54c8c">-->
...
<!--ME:</SharePoint:SPSimpleSiteLink>-->
Should become this:
<!--MS:<SharePoint:SPLinkButton runat="server" NavigateUrl="~sitecollection/" CssClass="ms-siteicon-a" ID="x7917ecc8c38d4bd69f58e338eab54c8c">-->
...
<!--ME:</SharePoint:SPLinkButton>-->
Ref link
Method 2:
We are going to add custom js in the master page => our site is a publishing site
We find the site logo in the below hierarchy(in a rendered page).
<div id='DeltaSiteLogo'>
<a href='site url'>
<img src='siteIconPath.png/whatever extension'/>
</a>
</div>
So we may try the following for redirecting to the site collection/root web url on click of the logo.
// Add the following js in the '.html' design file that associates with the corresponding masterpage.
<script type="text/javascript">//<![CDATA[
$(document).ready(function(){
$("div#DeltaSiteLogo a").attr("href",_spPageContextInfo.siteAbsoluteUrl);
});
//]]>
</script>
It works.
Edit on the SharePoint Designer Master Pages > seattle.master .
Crtl F - Search for DeltaSiteLogo
DEFAULT:
<SharePoint:SPSimpleSiteLink CssClass="ms-siteicon-a" runat="server" id="onetidProjectPropertyTitleGraphic" >
<SharePoint:SiteLogoImage CssClass="ms-siteicon-img" name="onetidHeadbnnr0" id="onetidHeadbnnr2" LogoImageUrl="/_layouts/15/images/siteIcon.png?rev=47" runat="server"/>
</SharePoint:SPSimpleSiteLink>
Change To This (copy & paste the script):
<SharePoint:SPLinkButton runat="server" NavigateUrl="~sitecollection/" CssClass="ms-siteicon-a" ID="x7917ecc8c38d4bd69f58e338eab54c8c">
<SharePoint:SiteLogoImage CssClass="ms-siteicon-img" name="onetidHeadbnnr0" id="onetidHeadbnnr2" LogoImageUrl="/_layouts/15/images/siteIcon.png?rev=47" runat="server"/>
</SharePoint:SPLinkButton>

Multiple Rich Text Edit Fields in Edit View

I have a Sharepoint site with a Master Page that has a main content area and a sidebar content area.
In one of my pages I have the need to allow the user to edit the content of the main content area and the sidebar content area from the Edit mode.
Currently, in the HTML of one of my pages, in main content area of a page (inside <asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">) i have the follow code snippet which appears to allow a HTML edit box in Edit mode.
<SharePoint:EmbeddedFormField id="wikiField" FieldName="wikiField" ControlMode="Display" runat="server" />
I have tried to replicate this inside the <asp:Content ContentPlaceHolderId="PlaceHolderSidebar" runat="server"> tag, but this simply displays the content of my main body content and does not give me the option to edit this.
When a user enters Edit mode, I need to display two rich text HTML editors, one for the main content and one for the sidebar. What HTML tags will allow me to achieve this?
I do not have access to SharePoint Designer 2013 and cannot install it for reasons I will not go into.
Thanks
Try using this:
<PublishingWebControls:RichHtmlField FieldName="PublishingPageContent" HasInitialFocus="True" MinimumEditHeight="400px" runat="server"/>
And add a reference to this if it's not already at the top of your master.
<%# Register Tagprefix="PublishingWebControls" Namespace="Microsoft.SharePoint.Publishing.WebControls" Assembly="Microsoft.SharePoint.Publishing, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
You may need to activate the publishing feature for this - I can't remember if it works without it or not.

Setting Page.Title from the codebehind of a Sitecore sublayout (user control) doesn't work

I'm having an issue setting Page.Title for a page from the codebehind of a usercontrol (sublayout).
We have a layout, MainLayout.aspx. I can set the page title from the codebehind of this page, and it works fine. However, if, after this, I try to set the page title in the codebehind of MySublayout1, the new value is set for the Page.Title property, but the change is not reflected on the page.
I've tried moving the code from the Page_Load to the OnInit events for both the page and the control, but nothing seems to work. Any idea why this doesn't work?
The best approach for this is creating an new rendering or sublayout that renders the -section of your page. So you can set the values in literals or sc:text controls in the sublayout instead of setting only the Page.Title from codebehind.
This way you can set more properties all at once like the meta-keywords and meta-description, based on the current Sitecore Item.
I'd add the following to the layout or sublayout that is in it:
<head runat="server" id="_Head">
<title><sc:FieldRenderer ID="frTitle" runat="server" FieldName="title" /></title>
</head>
Also make sure that you call DataBind(); or set Sitecore.Context.State.DataBind to true.
If you want the Sublayout to override the title set in the Layout, you can move the code in the Layout to Page_Init and use Page_Load in your Sublayout.
If that doesn't work, then your Sublayout may have trouble accessing the Page. You can try using WebUtil.CurrentPage.Title to access the current page title. It might also require that you set runat="server" on the head and title elements as follows:
<head runat="server">
<title runat="server"></title>
You can simply use this:
< title> <%=Sitecore.Context.Item["PageTitleFieldName"] %> < /title>
It works fine to render page title from given field.

An iframe's vertical scrollbar does not work when the target is a SharePoint page

Background
I have a basic HTML page with an iframe that points to a page with a SilverLight object on it. When the Silverlight object extends past the predefined height, the vertical scroll bar is displayed but in an inactive state. Below is my HTML and screen shots of the iframe.
Question
Is it possible to have a vertical scroll bar in an iframe when the target page contains a Silverlight object?
Code
<html>
<body>
<form>
<div>
<IFRAME height="300" width="1000" name="MyFrame" scrolling="yes"
src="http://mycompany.com/mysilverlightpage.aspx">
</IFRAME>
</div>
</form>
</body>
</html>
Screen Shots
This issue had nothing to do with Silverlight but with the SharePoint masterpage hosting the web part that hosted the Silverlight object. To allow the vertical scroll in this case the following changes need to be made to the masterpage. I created a custom masterpage based off for my business needs so I didn't have to worry about these mods wrecking the rest of my environment.
Remove scroll="no" from the body tag
Remove the two divs surrounding the "PlaceHolderMain" ContentPlaceHolder
<div ID="s4-workspace" class="s4-nosetwidth">
<div ID="s4-bodyContainer">
<asp:ContentPlaceHolder id="PlaceHolderMain" runat="server"/>
</div>
</div>

Resources