RSS Dave on Twitter

Hiding the user presence icon

Posted: January 6th, 2010 | Author: davecavins | Filed under: General SharePoint | Tags: , , , , , | 1 Comment »

When you are using a data view web part to display information including a person field SharePoint always shows the status icon beside thier name.

status icon

status icon

In some cases this is exactly what you want and can be very useful. But sometimes you just want to show a name and nothing else. With most fields you can just change the formatting options to change the display. If you choose to format the value as text SharePoint spits out this long html string.

<nobr><span><A HREF="/sites/site/_layouts/userdisp.aspx?ID=2">Cavins, David R</A><img border="0" height="1" width="3" src="/_layouts/images/blank.gif"/><a href='javascript:' onclick='IMNImageOnClick();return false;' class='ms-imnlink'><img name='imnmark' title='' border='0' height='12' width='12' src='/_layouts/images/blank.gif' alt='No presence information' sip='email@email.com' id='imn_8,type=sip'/></a></span></nobr>

Format as


Each of the other formatting options also provides un-desirable results.
Using some basic CSS we can get rid of the status icon and format the text so it does not look like a hyperlink. First wrap the field value in an element with a class. I used a span with a class of “person”

<span class=”person”>
<xsl:value-of select="@Author" />
</span>

Then just add this css to the page.

.person nobr span a {
text-decoration:none;
color:black;
cursor:default;
}

If you want to take it a step further you can use jQuery to remove the ‘href’ attribute. Using jQuery we can target the container with the link in it and then change the href value.

$('span.person a').removeAttr('href');
Bookmark and Share

Related posts:

  1. Styling SharePoint Blog Comments
  2. Styling SharePoint Blog Comments: Part 2
  3. Switch List Displays with JQuery and CSS
Share on Google Buzz

One Comment on “Hiding the user presence icon”

  1. 1 Nancy said at 8:23 am on May 24th, 2010:

    Thanks for the info on howto chage the appearance of the people picker value!

    Can you elaborate a bit more on how to remove the actual hyperlink? I am having trouble using the single line of jquery you indicated.


Leave a Reply

Get Adobe Flash playerPlugin by wpburn.com wordpress themes