SharePoint Branding Issues: MySite Control
This is the first of the more specific articles regarding SharePoint Branding. They will go from small issues to bigger ones.
One of the controls a SharePoint design usually sports is the My Site control. This is a control with a link to the current user’s MySite. But unfortunately this is not the only thing this controls adds. It also adds a pipe character (|) just to the right of the link. No problem, I thought. As it is a delegate control, it’ll use some custom control from the control templates. I’ll just have to remove the pipe from the control. I went to the control templates and bingo, there was MySiteLink.ascx. Wrong, as it seems, the control uses some code behind file where it programatically adds the pipe.
this.hlMySiteSpacerSuffix.Text =
"<span style='padding-left:4px;padding-right:3px'>|</span>";
So how can I quickly remove the pipe, without having to rewrite another delegate control to take its place, or a whole new other control to render the special MySite link? The answer is CSS. As it turns out, the pipe is rendered within a span tag. So when adding the delegate control, make sure you encapsulate it within a specific css reference, for example: .removeSpan. In your css, you just have to define the following:
.removeSpan span
{
display: none
}
Voila, one pipe free MySite link. Sure, it’s still on the page, but the design does not get screwed up by it. Problem solved.
January 13th, 2008 at 1:29
Brilliant! Thanks for this tip…very helpful.
January 28th, 2008 at 22:31
Glad it helped!
February 26th, 2008 at 12:42
just what i’ve been looking for, i have a problem though, i can only get it to work on the root site, all the other sites still have the pipe, i’ve implemented the solution on the masterpage, could i be missing something obvious ?
thx
February 27th, 2008 at 0:04
Well, the other sites should use the master page too. So make sure they inherit the master page from the root site. You should also check if the css is available from the location of the subsites. Don’t forget to publish your changes. And remember application pages use another master page: application.master.
Hope it helps.
March 26th, 2008 at 21:35
Great!!
Just saw a fantastic web part called MySite Designer from http://www.webparts4sharepoint.com – we have started using this and now have MySites preconfigured. Take a look at it!!
Thanks.
Henrik B.