Documentation

IUser

The IUser object stores all information about a user. You can use Api.User.Get(userId) to retrieve different users, or use Model.Context.User to get the current user. In either case what is returned is an instance that implements IUser.


OpenRoad.ThoughtFarmer.Core.Content.IUser

Properties
Name Type Description
ContentId int The content ID for the user's profile page.
UserId int The unique userID for this user.
Deleted bool A flag to indicate if the user is deleted or not.
IsActive bool A flag to indicate if the user is active or not.
AllowAdminMode bool Indicates if the user can enter admin mode or not (i.e. they have site admin access).
AreBookmarksPublic bool Indicates if bookmarks are visible to other users. 
Birthday DateTime The user's birthday as set in their profile. 
DefaultCulture string The default culture (e.g. "en"). 
UserName string The full username (e.g. "DOMAIN\username")
Email UserEmail Returns the UserEmail object (shown below) that holds the user's primary and alternate emails.
FullName string The user's full name. Will show preferred name if they have one set.
FullNameLastNameFirst string The user's full name, last name first. 
GroupTitle string The title of the user's default group. This is used if they have "Use this address" set in their profile. 
ModifiedDate DateTime The last time a user's profile was modified. 
IsCustomAddress bool This is true if they have "Use this address" set in their profile. 
IsEndUserAgreementAccepted bool True only if they have logged in and accepted the terms and conditions. 
IsGuest bool If guest mode is enabled and this user does not have a profile then they will be flagged as a guest.
JobTitle string The job title as specified in the user's profile. 
PhoneTel string The phone number as specified in the user's profile. 
PhoneMobile string The mobile number as specified in the user's profile. 
PhoneFax string The fax number as specified in the user's profile. 
Image Image The Image object representing their current profile picture. 
Status string The user's latest status. 
StatusLastUpdated DateTime The last time the status was updated. 
TimeZone TimeZoneInfo The user's time zone. 
Url string The url for the user's profile page (e.g. "/content/7")
UserAddressLine1 string The address set in the user's profile. 
UserAddressLine2 string As above.
UserAddressLine3 string As above.
UserAddressLine4 string As above.
UserGroupContentId int The content ID for the group set if they have "Use this address" set in their profile. 
ManagerId int The user ID for the user's manager.

Methods
Name Return type Description
CanEdit(IPage content, IContext context) bool Checks to see if the user can edit the supplied page. 
CanView(IPage content, IContext context) bool Checks to see if the user can view the supplied page. 


Example usage:
@{
var sectionPages = this.Api.Content.GetChildren(123); // some other section

 foreach(var page in sectionPages)
 {
      var user = this.Api.User.Get(page.Audit.OwnerId);
      <div>
           <h4><a href="@page.Url">@page.Title.Get(this.Model.Context.Culture, this.Model.Context)</a></h4>
           <div class="custom-owner-info">
                 Owned by: <a href="@user.Url">@user.FullName</a> @Html.If(!user.IsActive, "[Inactive]")<br/>
                 Email: <a href="mailto:@user.Email">@user.Email</a>
           </div>
      </div>
 }

}