All about the Strategy, Design, Customisation, Deployment and Development of SharePoint and its related Technologies

  Administration   All Me!! Baby!!   BDC   Book Review   Business   CKS   Conferences   CQWP   Development   Duffer Moments   Email   Errors   Family   Fixes   General   Groove   How To   How To Code   InfoPath   iPhone   IRM   Longhorn   Lotus Notes   Migration   Mobility   Office System 2007   Personal Projects   Powershell   Records Management   Search Server   Security   SharePoint   SharePoint 2010   Silverlight   SQL   Tech Ed 2008   Testing   Vista   VSTO   WSS   XSL

[01/09/2007] MOSS2007 - Hide “My Settings” Link
 
Categories: Development, Office System 2007, SharePoint
 

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:

  1. Navigate to the following directory:

    C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\CONTROLTEMPLATES

  2. Copy the "Welcome.ascx" and rename to "Welcome.ascx.original"
  3. Edit the "Welcome.ascx" file in notepad
  4. Remove the following code block: (This is the block that renders the "My Settings" link

     

  5. Make sure you save these changes
  6. When you access the page the menu should now render as below:

     

  7. Now that the "My Settings" link is removed you need to create a feature that will create the new "My Settings" link
  8. Navigate to the following directory on the server:

    C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\FEATURES

  9. Copy any of the folders and rename to "DemoMySettingsLink"
  10. 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

  11. 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>

  12. Save the file
  13. 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

  14. Save the file
  15. 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
  16. To install the feature open up a command window on the same server
  17. 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

  18. 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"

  19. To activate the syntax onto the portal, navigate to the following URL:

    http://{portalurl}/_layouts/ManageFeatures.aspx?Scope=Site

  20. The feature should now be listed under the name: "Demo My Settings Link"
  21. 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.

 
16 Comments
 

Comments

Sunday, 2 Sep 2007 09:36 by Qazi
nice technique!

Tuesday, 11 Sep 2007 09:57 by Andy Walmsley
Hi Liam,

Great Post. 

I did wonder why you didn't opt for 'disabling' the mysite functionality from the SSP which will not provide the mysite facility to users and also have the benefit of restricting what users edit via the My Settings Link?

This would seem to be a 'no code route' for the same effect? Granted you still see the My Settings link.

Regards,
Andy

Tuesday, 11 Sep 2007 10:29 by Liam Cleary
Hey Andy,
    Glad you like the post!! :-)
The My Site permission was disabled, so no My Sites can be created. The problem was that even though this was disabled the users could still access a weird "localised" my settings page that looked like their profile but would not allow them to edit. What the client wanted was to not show this but replace this link with the "Person.aspx" which is the main page for a profile. I suppose the same effect as the permission option but with a little extra!! :-)

Liam

Wednesday, 12 Sep 2007 05:45 by Mario
Liam,

Can you help me with one question that I think you will laught...

How can I replace the "domain\user" from the master place with the "AD Display Name".

Thanks for your help!

Mario

Friday, 14 Sep 2007 02:03 by

Wednesday, 26 Sep 2007 12:23 by Jason
I am trying to implement this on our site but I get the following error when running the stsadm command to install the feature.

Illegal feature Id attribute 'demomysettingslink\feature.xml' for feature at 'AC
929AGG-4802-4d7f-A501-B80AC9A4BB52'.  A feature identifier must be a guid.

Any help would be greatly appreciated.

Thanks

Wednesday, 26 Sep 2007 12:24 by Jason
I am trying to implement this on our site but I get the following error when running the stsadm command to install the feature.

Illegal feature Id attribute 'demomysettingslink\feature.xml' for feature at 'AC
929AGG-4802-4d7f-A501-B80AC9A4BB52'.  A feature identifier must be a guid.

Any help would be greatly appreciated.

Thanks

Wednesday, 26 Sep 2007 12:56 by Liam Cleary
Hi Jason,
Hope you are well. From what you have pasted here, it looks like there is a space between the "AC" and the rest of the reference. If you remove the space it should work or just replace the GUID with the following:

AC929AGG-4802-4d7f-A501-B80AC9A4BB52


Let me know

Monday, 15 Oct 2007 08:37 by Zac Smith
I think this is definately the easiest way of changing the "My Settings" link, I also have an alternative solution that you may be interested in: http://zac.provoke.co.nz/archive/2007/10/15/how-to-customize-the-user-information-page-part-2.aspx

Monday, 22 Oct 2007 10:05 by Talin
It was great. Thank you.

Wednesday, 14 Nov 2007 07:13 by Tonny
Great post! I was able to create this feature and it works great if I sign in as an administrator. A user with Restricted Read permissions get "Value does not fall within the expected range." if they click on the My Settings link. Is there something I missed? My site is using FBA...

Saturday, 29 Mar 2008 11:23 by Rahul Patel
In order to avoid affecting all sites in the farm, would it suffice to do the following: 1. Copy the Welcome.ascx user control into a custom directory such as \TEMPLATE\CONTROLTEMPLATE\\Welcome.ascx 2. Set the menu item for My settings to Visible="Falses" 3. Change master pages to reference the new user control It seems to work for me but not sure if I'm not aware of other location the welcome.ascx control may be referenced.

Tuesday, 15 Apr 2008 05:27 by Samuel Morin
Rahul!!! You are correct... That is the best way to do this

Monday, 23 Jun 2008 09:07 by suman
i guess you could just add the HIDDEN attribute to the feature & assign it as 'true'.

Friday, 3 Oct 2008 03:58 by Sharepointer
As far as I understand, changing the Welcome.ascx file could result in losing the changes, when a next hotfix or service pack overwrites the file - is it not so? So, it would alsways be better to do such changes from within features.

Tuesday, 25 Nov 2008 07:26 by Pill Store
Excellent article, added to bookmarks.

Name:

URL:

Email:

Comments: