was to copy the User.csthml file located in Orchard.Web -> Core -> Shapes over to Orchard.Web -> Themes -> YOUR THEME -> Views
This is a crucial first step often omitted from other discussions.
, you use the following directives in the cshtml file where you are running the user access code:
, this is the code that allows you to access user parts:
dynamic user = WorkContext.CurrentUser.ContentItem;
var containerTitle = "";
var containerContentType = "";
dynamic container = null;
var userPart = WorkContext.CurrentUser;
if (userPart.Has<CommonPart>() && userPart.As<CommonPart>().Container != null)
container = userPart.As<CommonPart>().Container;
containerTitle = ((ContentItem)container).As<TitlePart>().Title;
containerContentType = container.ContentType;
so this is what gets printed...
// hopefully everone has user first name, but otherwise fallback on username
var printUser = "";
if (user.UserDetails.FirstName.Value != null)
printUser = user.UserDetails.FirstName.Value;
printUser = WorkContext.CurrentUser.UserName;
@printUser // prints custom FirstName field captured at user registration, or lacking this prints username
@containerTitle // prints the title part of the container item for user, for example "Kickass Group"
@containerContentType // prints the type of the container, for example "Group", "Team", "Squad"
Lastly, it's worth noting that Im also using the contrib profile module to allow users to edit their profiles.
Thanks, hope this helps. If it doesn't, I'm around the forum.