This project is read-only.

Profile module vs New Customer ContentType with UserPart / Other parts

Topics: Customizing Orchard, Writing modules
Oct 29, 2012 at 7:57 AM
Edited Oct 29, 2012 at 8:05 AM

I'm working on a site where I need to implement Profile details for registered users.

Other than need to add several user entry fields (Name, Organization, Title, Picture etc), I also need to implement social features like "follow user", "friends request", Activity Feed, Messaging and Notification etc on profile. Additionally, I will also need to create many widgets of profile information to display at different part of the site... for example, profile photo widget, demographic info update widget etc.

My question is, whether I should use (and if needed, extend) Profile Module available on the gallery or should I create a brand new content type (say Customer) and attach UserPart and ProfilePart to it. I saw details of Web-shop module tutorial (part 8) from Sipke (thanks to him for awesome post)... but I'm still unable to decide which way would be easier and faster.

Here are my considerations...

1) If I use Profile module, I would add all the custom fields to ProfilePart. As I cannot (or do not want to) change User content type, I don't know how this will turn out if I have to create many widgets. also, I'm not sure "follow user" functionality is available in any module today, hence I'm thinking I need to keep info in database. All in all, it might work but I'm not sure about widgets part.

2) If I decide to user Customer approach, I need to create a Customer content type and attach UserPart and ProfilePart to it. I also need to custom create Customer creation while user registers. I'm thinking that this might give me flexibility I need but I'm not sure whether this is the right way to go thinking of what I need (I'm fairly new to orchard).

Can some provide me expert opinion on which direction is best to create above functionality?

Oct 29, 2012 at 8:46 AM
Edited Oct 29, 2012 at 8:47 AM

If you don't want to extend the "User" content type then I guess the way to go is to create a custom type, e.g. "Customer" and attach the UserPart. That means you will have to do certain things yourself, such as handling Customer registration, as you mentioned. I think this approach is just fine. From the looks of it, you will still be able to leverage most built in user management features, such as logging in and managing users from the backend, since Orchard primarily works with the UserPart instead of directly with the "User" content type.

Using the Profile module should be fine, unless you prefer to work with a strongly typed model. In that case I would create a custom ProfilePart and ProfilePartRecord.

Implementing Widgets should be easy, since all of your drivers will have access to the currently loggedin user, which (in most cases) will be a Customer. Just be sure to check if the current user is a "User" or a 'Customer" (or simply check if the current user has a ProfilePart before trying to access it).


Oct 29, 2012 at 9:02 AM

Thanks Sipke for quick response.

Just because is seems simpler, if I choose to use Profile gallery module with User Content type (i.e. not create customer content type) and add all the custom fields (Name, Title, Picture etc) to ProfilePart, do you see any issues with that approach? Do you see a need for me to modify User content type for any functionality?

In this particular case, would I be able to easily create widgets with Profile info? for example, i need to create widget to show profile picture of logged in user, would i be able to do that? I noticed that ProfilePart which comes with Profile module, is not attachable and I'm not sure whether that will cause any issues...

Also, there are several other modules in gallery (such as Avatar) which are dependent on profile module. If I decide to use them and they need profile module to be intact, would that cause any issues?

Thanks again.

Oct 29, 2012 at 9:45 AM

It's hard to tell without knowing exact requirements, but in general I don't see any issues with that. I also can't see why you would have to modify the User content type, besides attaching the ProfilePart to it (or just weld it on using an ActivatingFilter).

I'm certain it's easy to create such widgets, although I don't know if the Profile module comes out of the box with those. If it doesn't, just create your own ProfileWidget, with multiple templates using widget alternates: e.g. one alternate for the profile picture, another one that simply shows the username.

If the ProfilePart is not attachable, you can make it attachable using either the Admin UI or using a migration step, just as if you would make your own part attachable.

I'm not sure I understand your last question. Do you mean that you are considering using Avatar but not the Profile module? In that case Avatar will probably not work as it depends on the Profile module.


Oct 29, 2012 at 10:51 AM

Tippingpoint, how many users do you expect to have let's say in a year?

Orchard is currently not so good in handling a large amount of users (or content) as we ran in multiple issues with our 68k+ users (since they ALL act like 'content' in Orchard)

If we're talking a lot less users here, you could indeed create your own part and attach it to the user content type without problems.

Oct 29, 2012 at 12:58 PM

@AimOrchard. You are saying that you ran in multiple issues with large amounts of users. Which issues are you talking about? Logging in or retrieving user details, etc.? Would creating some indexes on the database make any difference? Have you tested this also on V1.6 of Orchard? 

Oct 29, 2012 at 1:04 PM
  • Unable to import/export any content (since on import orchard loads in _ALL_ content, including ALL users ...)
  • When I modified the 'User' content type and attached a custom part to it it enqueued some update for all User content items (it tried to enqueue 60k tasks..)
  • Taxonomy module was useless for us as some actions also triggered loading all users :/ (could be fixed in the meanwhile, but we had to move on so decided to do something custom)

Those are the 3 biggest problems that we ran into that I can think of at the moment.

Our site is online now, but yeah, we had to deal with some annoying issues with Orchard that arrise if you have a high amount of content (or users since they count as content).

A team member of mine is currently working on getting a branch updated to v1.6 but imho I dont think it is going to change much regarding these issues.

Oct 29, 2012 at 1:27 PM

Ok I could imagine that these problems could occur because I have seen these types of problems with types other then users.

Maybe It went better when you had added the custom part before the big import of those users. Though this must be solved because it must be possible to apply these kinds of changes with existing content.

Import and Taxonomies module are indeed not efficient with it's queries.

Oct 29, 2012 at 8:29 PM

I'm expecting 60-70 K users on the site in first year.

Based on Sipke's response, I'm thinking of going with using Profile module for my usage. Can anybody suggest any precautions I can take to have better performance down the line? I see myself using Caching of not frequently changing profile information a lot... 

Is there any merit in thinking of having "Profile" or "Customer" information implemented as non-content item? I remember seeing a Movie tutorial from Pluralsight which implement Actors as non content item but I don't know what are benefits or drawbacks of doing so... Please comment!!

Appreciate your help.

Oct 29, 2012 at 9:49 PM

Well, don't expect to be able to use the import/export to start with.

As advice I can say : make a 'raw' lookup table to store 'quick' information about your users (fetching user parts is 'heavy' compared to fetching a 'raw' record)

We have the user part with a custom part attached that stores all information and a 'raw' lookup table to store basic information (username, name, profile picture uri etc)