Tags

It is possible to get through JQuery the current user in SharePoint;

 var currentuser;

function checkCurrentUser() {
var context = SP.ClientContext.get_current();
var siteColl = context.get_site();
var web = siteColl.get_rootWeb();
this._currentUser = web.get_currentUser();
context.load(this._currentUser);
context.executeQueryAsync(Function.createDelegate(this, this.CheckUserSucceeded),
Function.createDelegate(this, this.CheckUserfailed));

function CheckUserSucceeded() {
currentuser =this._currentUser.get_loginName;
}

 function CheckUserfailed() {
log(‘retrieving user failed’);
}