Re: Using the 'ContainsCurrentUser' in the Javascript editor of a Group page
Posted: 16 Oct 2015
Code below will work with display pages:
Code: Select all
SP.SOD.executeOrDelayUntilScriptLoaded((function () {
var ctx = new SP.ClientContext.get_current();
var web = ctx.get_web();
ctx.load(web);
var user = web.get_currentUser();
user.retrieve();
ctx.executeQueryAsync(
function () {
var dic = [];
fd.field('Name08').control()._el().find("tr a").each(function() {
dic.push($(this).text());
});
var found = false;
for (var i = 0; i < dic.length; i++) {
if (dic[i] == user.get_loginName()){
found = true;
}
}
if (found) {
$('.Table').show();
}
else {
$('.Table').hide();
}
});
}), "SP.js");