Adding containable part to User content type via Profile module

Topics: Administration, Troubleshooting
Jan 16, 2012 at 10:52 PM

I installed the Contrib.Profile module & was looking at adding parts to the User content type. 

I saw the suggestion in the UI that adding the containable part would enable me to add users to a list, and I thought what a good idea!  So I went ahead & added the containable part.  Then I tried creating a list of users.  I noticed a couple of problems.

  1. The list created ok, but no users were offered for inclusion in the list (I do have some).
  2. I clicked the "create new user" button - there was no username or email field.  I added it to my list & clicked save anyway to see what would happen. 

What happened was:

  1. that there are still no users shown in the list, and 
  2. The Users dashboard now breaks, because I now have a user with no username.  I got around it ok by modifying \Modules\Orchard.Users\Views\Admin\Index.cshtml to remove the entry.User.UserName & then editing the user.

I think there's a couple of things going on here & I'm wondering where to start :-)

Jan 17, 2012 at 1:23 AM

Does User have CommonPart?

I take it this is version 1.3; it could be another problem caused by UserPart not having a UserPartDriver (something that's fixed in 1.x branch).

Jan 17, 2012 at 1:55 AM

No, it's the latest 1.x code. 

I just tried again on a new default install (without installing the Profile module though).  This time, the User content type was there (I didn't think it was before I'd installed the Profile module before, but I'm probably mistaken).

So looking at the User content type - there is no Common part there. 

I did add containable though & again the List & "Create new user" from the list had the same problems as I described.

After I posted, I realised that probably the Projector module will be best for lists of users anyway? (just guessing).  In which case none of this is really a problem, aside from the fact then any newbie admin user like me could break their Users dashboard this way.

I would create an Issue, but it's still a bit vague to me...!

Jan 17, 2012 at 2:42 AM

Containable relies on the CommonPart being there - it requires the Owner field which is a property of CommonPart. So perhaps there is a bug here - ContainerPart should report that you need CommonPart if you attempt to add it to a content type that doesn't have it.

Jan 17, 2012 at 10:14 PM

Interesting :-)  I tried adding the Common Part to User & crashed IIS.  I've created an issue: http://orchard.codeplex.com/workitem/18365

Jan 17, 2012 at 10:50 PM
Edited Jan 17, 2012 at 10:51 PM

I got it slightly wrong, containable uses the "Container" field not "Owner" (a user being "Owned" by another user would be a bit strange in this case) but it's still on CommonPart and that really shouldn't be crashing IIS so definitely a bug! ;)