On a few recent projects I have been asked whether or not you can hide the "My Settings" link that appears on the menu underneath the "Welcome" message. The reason for this was that they were not going to use "My Sites" yet. The link that appears on this menu simply takes you to a page where the users are supposed to be able to edit information about them. To enable this approach all that was needed was to somehow redirect the "My Settings" link to the following URL:
http://{mysiteurl}/person.aspx
The "My Settings" link is drawn using a server control called "Welcome. ascx". The current rendering of the menu is shown below:
I could have created a completely custom "Welcome.ascx" file simply modified the master page to use this. As most of the clients I have worked with will be rolling out "My Sites" in the future I wanted a simply and quick method or doing this. To replace the "My Settings" I decided to modify the "Welcome.ascx", well a copy of it and then create a feature to create a new "My Settings" link. To do this:
Navigate to the following directory:
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\CONTROLTEMPLATES
- Copy the "Welcome.ascx" and rename to "Welcome.ascx.original"
- Edit the "Welcome.ascx" file in notepad
Remove the following code block: (This is the block that renders the "My Settings" link
- Make sure you save these changes
When you access the page the menu should now render as below:
- Now that the "My Settings" link is removed you need to create a feature that will create the new "My Settings" link
Navigate to the following directory on the server:
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\FEATURES
- Copy any of the folders and rename to "DemoMySettingsLink"
Remove all the files inside the folder except the "fetaure.xml" and the "elements.xml"
NOTE: If they do not exist in the folder create blank files named as the above
Edit the "feature.xml" file within Notepad and add the following code block
<Feature
Id="AC929AGG-4802-4d7f-A501-B80AC9A4BB52"
Title="Demo My Settings Link"
Description="Demo Hide the current My Settings link and replace with custom Link"
Scope="Site"
xmlns="http://schemas.microsoft.com/sharepoint/">
<ElementManifests>
<ElementManifest Location="Elements.xml" />
</ElementManifests>
</Feature>
- Save the file
Edit the "elements.xml" and add the following code block:
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
Id="0aghjd94-ebh8-21db-8314-0976200c9a66"
GroupId="PersonalActions"
Location="Microsoft.SharePoint.StandardMenu"
Sequence="1"
Title="My Settings"
Description="View My Settings"
ImageUrl="/_layouts/images/menuprofile.gif">
<UrlAction Url="http://mysites/Person.aspx"/>
</CustomAction>
</Elements>
NOTE: Ensure at this point that the "URLAction URL" is set to the correct URL for your system
- Save the file
- To validate the XML simply open each file up within Internet Explorer and make sure that all the lines render successfully. If not make the change and re-save
- To install the feature open up a command window on the same server
Either manually navigate to the following directory or use the second syntax below to get there:
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\BIN
Or direct in a command box type:
pushd C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\BIN
The syntax for installing is:
stsadm –o installfeature –filename "DemoMySettingsLink\feature.xml"
As a note to uninstall it use the following:
stsadm –o uninstallfeature –filename "DemoMySettingsLink\feature.xml"
To activate the syntax onto the portal, navigate to the following URL:
http://{portalurl}/_layouts/ManageFeatures.aspx?Scope=Site
- The feature should now be listed under the name: "Demo My Settings Link"
- On the right hand side click the "Activate" button
Now that the feature is activated, the menu should display as shown below:
Now we removed the "My Settings" link and created our own custom one. The beauty of this idea is that to revert back all that needs doing is deactivating the feature and setting the "welcome.ascx" back to what is was. Nice and simple. I am sure there are others ways of doing the same but this seemed the quickest and simplest. |