To change the text and the color of the Site Actions menu copy and paste the following code at the end of your master page:
<script language="JavaScript"> $(document).ready(function () { $("span.ms-siteactionsmenuinner > a.ms-menu-a").html("My Actions"); $("span.ms-siteactionsmenuinner > a.ms-menu-a").css('color', 'white'); }); </script>
A quick and dirty way of customizing the Site Actions menu is to add a MenuItemTemplate element straight to the menu on your master page.
At first find the following snippet on the master page:
<span class="ms-siteactionsmenu" id="siteactiontd"> <SharePoint:SiteActions runat="server" accesskey="<%$Resources:wss,tb_SiteActions_AK%>" id="SiteActionsMenuMain" PrefixHtml="" SuffixHtml="" MenuNotVisibleHtml=" "> <CustomTemplate> <SharePoint:FeatureMenuTemplate runat="server" FeatureScope="Site" Location="Microsoft.SharePoint.StandardMenu" GroupId="SiteActions" UseShortId="true">
Then, insert a custom MenuItemTemplate element inside the FeatureMenuTemplate container:
<SharePoint:FeatureMenuTemplate runat="server" FeatureScope="Site" Location="Microsoft.SharePoint.StandardMenu" GroupId="SiteActions" UseShortId="true"> ... other menu item templates goes here ... <SharePoint:MenuItemTemplate runat="server" id="MenuItem_MyAction" Text="My Action" Description="Do something when the menu item My Action is selected." ImageUrl="/_layouts/images/visualupgradehh.png" MenuGroupId="300" Sequence="305" UseShortId="true" ClientOnClickNavigateUrl="˜site/_layouts/MyLayoutPages/MyAction.aspx" PermissionsString="ManageSubwebs" PermissionMode="All" />
Knowing the id (SiteActionsMenuMain) and the structure of the Site Actions menu it is possible to reference MenuItemTemplate elements in the code-behind:
if (SiteActionsMenuMain.Controls.Count > 0 && SiteActionsMenuMain.Controls[0] != null) { if (SiteActionsMenuMain.Controls[0].Controls.Count > 2) { FeatureMenuTemplate menu = (SiteActionsMenuMain.Controls[0].Controls[2] as FeatureMenuTemplate); if (SiteActionsMenuMain.Controls[0].Controls[2] is FeatureMenuTemplate) { MenuItemTemplate item = menu.FindControl("MenuItem_MyAction") as MenuItemTemplate; // Do something with the MenuItem_MyAction item, for example, hide it: item.Visible = false; } } }