Customising content based on user profile

Topics: Customizing Orchard, Writing modules
Jul 10, 2013 at 1:16 PM
I am a complete noob to Orchard, although I am an experienced ASP.NET MVC developer.
I am currently looking at possible solutions for a CMS system that I have been asked to quote for, and Orchard seems to tick most of the boxes.
One issue I am not sure about it this - I need to be able to tailor content based on the "type" of user who is logged in.
So to clarify, site users will be required to log in before they can use the site.
An administrator will be able to store a "type" of user against each user's profile (which will be invisible to the user).
The administrator will also create variations on pages based on the user "type" so that the user is only shown content deemed relevant to them.
Is this possible, and if so how might I go about achieveing this?
Developer
Jul 10, 2013 at 3:02 PM
Edited Jul 10, 2013 at 3:04 PM
Definitely possible.
  • To protect your site from unauthorized access, use the Content View Permissions feature.
  • Either create your own UserProfilePart with profile settings, user types etc. or attach content fields to the User content type that will store user specific information such as the user type
  • If you create the UserType as a content type, you can attach a ContentPickerField to that type so that you can choose which content items should be presented to users of that type.
  • Create a custom controller that drives the pages to be rendered based on the current user. Or, create a new content type with a custom part that renders a list of accessible content items for the current user. All this depends on your exact requirements.
  • PLUS: You probably need to implement a custom permissions provider to prevent users from accessing content that is not accessible to the current user's user type.
Orchard has a lot of functionality out of the box and lets you easily implement business specific requirements.