While working with Sharepoint User Profiles I have had to perform a hack to remove Mapped property images or Warning property images from the Sharepoint User Profiles edit page. Using the default ShowMappedIcon or ShowWarningIcon properties of the “UserProfileEditor” control easily allow you to hide the warnings and mapping information however it destroys the layout of the rest of the editing page by missing lots of table cells and results in an ugly looking page.
As a result i had to instead leave ShowMappedIcon=”true” and then use the following javascript to hide all the mapping images and wording:
/// <summary>
/// Hide mapping text and images.
/// </summary>
function clearMappingDisplay() {
try {
//Hide Mapping Images
//Find all images on page
var images = document.getElementsByTagName('IMG');
for (var i=0; i < images.length; i++) {
var curImage = images[i];
//If image is for "Mapped" property
if(curImage.alt == "Mapped") {
//Replace image with blank.gif & hide image
curImage.src = curImage.src.replace("mapped", "blank");
curImage.style.visibility = "hidden";
}
}
//Hide mapping text
//Get tblMain container
var mainTable = document.getElementById('tblMain');
//Get all tables within main table
var subTables = mainTable.getElementsByTagName('TABLE');
for (var i=0; i < subTables.length; i++) {
var curTable = subTables[i];
//Find the table that includes the mapping text
if(curTable.innerText.indexOf("mapped for profile import") > -1) {
for (var k=0; k < curTable.cells.length; k++) {
var cell = curTable.cells[k];
//Find the cell that contains the mapping text
if(cell.innerText.indexOf("mapped for profile import") > -1) {
//Clear the mapping text
cell.innerText = "";
}
}
}
}
}
catch (ex) {
//TODO: Handle error.
}
}
//Ensure sharepoint runs the clearMappingDisplay method on Page (Body) Load
_spBodyOnLoadFunctionNames.push("clearMappingDisplay");