1
votes

Here's my problem:
This pipeline was overriden in an attempt to display the users real name.

Sitecore.Pipelines.GetContentEditorWarnings.IsLocked

The change was simply to use the Item.getUpdatedBy() instead of Item.Locking.GetOwner() of lock because the thought was that anyone who updated the item would have to lock the item. The getUpdatedBy() also displyed the Context.user.profile.fullname along side of the user name. The problem is that a user can update an item without actually locking the item so you'd see the lock field filled with a different user than the last updated user.

What I'd like todo: I need to display the item's lock owner fullname (context.user.profile.fullname). How do I get the context.user.profile from the lock owner (Item.Locking.GetOwner()) information?

let me know if i need to be more clear. Thanks, Chris

1

1 Answers

2
votes

The Item.Locking.GetOwner() method just returns the username of the person who holds the lock. From the username you will need to get the user and then their profile. There are probably a few ways to handle this... here is one.

string username = theItem.Locking.GetOwner();
Sitecore.Security.Accounts.User user = Sitecore.Security.Accounts.User.FromName(theItem, false);
Sitecore.Security.UserProfile profile = user.Profile;
string fullName = profile.FullName;