Good points Joe. I sat in the corner with a dunce cap on for 15 minutes and then I followed your advice and created a user control for this. Let me know if I missed anything. I agree this solution is purely cosmetic but I think Hrushikesh isn't after much more than that.
Create two files, AdminOnlyLinks.cs and AdminOnlyLinks.ascx.cs. Save these files in \Controls\Custom (you will have to create the Custom directory).
AdminOnlyLinks.ascx
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="AdminOnlyLinks.ascx.cs" ClassName="AdminOnlyLinks.ascx" Inherits="Controls_AdminOnlyLinks" %>
<portal:SiteMapLink id="SiteMapLink2" runat="server" CssClass="sitelink" RenderAsListItem="true" />
<portal:MyPageLink id="MyPageLink1" runat="server" RenderAsListItem="true" />
<portal:UserProfileLink id="UserProfileLink" runat="server" RenderAsListItem="true" />
<portal:MailboxLink id="MailboxLink1" runat="server" RenderAsListItem="true" />
<portal:SearchInput id="SearchInput1" LinkOnly="True" RenderAsListItem="true" runat="server" />
AdminOnlyLinks.ascx.cs
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using mojoPortal.Web;
using mojoPortal.Web.UI;
using mojoPortal.Web.Framework;
using mojoPortal.Business;
using mojoPortal.Business.WebHelpers;
public partial class Controls_AdminOnlyLinks : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
PageSettings currentPageSettings = CacheHelper.GetCurrentPage();
SiteSettings siteSettings = CacheHelper.GetSiteSettings(currentPageSettings.SiteId);
string siteRoot = WebUtils.GetSiteRoot();
if (
(WebUser.IsAdminOrContentAdminOrRoleAdmin)
|| (
(WebConfigSettings.UseRelatedSiteMode)
&& (WebUser.IsInRoles(siteSettings.SiteRootEditRoles))
)
)
{
this.Visible = true;
}
else
{ this.Visible = false;}
}
}
Add the following to your layout.master after the <%@Master.
<%@ Register Src="~/Controls/Custom/AdminOnlyLinks.ascx" TagName="AdminOnlyLinks" TagPrefix="cc1" %>
Add the following to your layout.master in the location you want the links to appear.
<cc1:AdminOnlyLinks id="hiddenlinks1" runat="server" />
Also note:
-
The Memberlist and Mypage can be controlled with the "Roles that can view the member list page" permissions under Security in the Site Settings.
-
You can also disable Mypage by deselecting the "Enable MyPage Feature" option on the General tab in the Site Settings.
-
You can disable registration by deselecting the "Allow New Users to Register" option on the Security tab in the Site Settings.
HTH,
Joe D.