I went through the sputility.js file and found this piece of code
x.done(function (result) {
// result is an SP.List because that is what we passed to resolve()!
var htmlText = "";
for (var i = 0; i < result.users.length; i++) {
var user = result.users[i];
if (htmlText !== "") { htmlText += "; "; }
htmlText += '<a href="/_layouts/15/userdisp.aspx?ID=' + user.get_id().toString() + '&RootFolder=*">' + user.get_title() + '</a>';
}
// finally! send the result to our callback
return callback(htmlText);
});
I modified the htmlText+=
line to include the relative url of the current sub-site/site using _spPageContextInfo.webServerRelativeUrl
thanks to this question and it works like i expected.
x.done(function (result) {
// result is an SP.List because that is what we passed to resolve()!
var htmlText = "";
for (var i = 0; i < result.users.length; i++) {
var user = result.users[i];
if (htmlText !== "") { htmlText += "; "; }
htmlText += '<a href="'+_spPageContextInfo.webServerRelativeUrl+'/_layouts/15/userdisp.aspx?ID=' + user.get_id().toString() + '&RootFolder=*">' + user.get_title() + '</a>';
}
// finally! send the result to our callback
return callback(htmlText);
});
before i found this solution i was using something like this
var changeLink=function(){
if($('div.sputility-readonly a').length ===1){
//console.log('href set. clearing interval');
clearInterval(timerInterval);
$('div.sputility-readonly a').each(function(){
var oldhref=$(this).attr('href');
//console.log(oldhref);
$(this).attr('href','/sites/site_collection/sub_site'+oldhref);
//console.log('new href '+$(this).attr('href'));
});
}
else{
//console.log('href not set yet');
}
};
timerInterval=setInterval(changeLink,100);
which i used to run whenever i make a Person field as readonly..