Sports Team Module

Topics: Customizing Orchard, Writing modules
May 8, 2011 at 3:32 PM


I have this old website for my club (snooker) which I want to upgrade using Orchard CMS.
For that to work I have to create a sports team module, so the administrator have the possibility to set up members and their break records, and manage all our leagues and results.

Since being new to Orchard this will probably take some time, but I am very eager to begin.
The first thing I hope for advice is whether to use the Orchard.Users for the members of my club, or should I just implement my own TeamMember? 

I tried, btw, to list all my users in a very, very easy module (Following the HelloWorld module as base), but I don't know how to get my Team.HomeController to fill the Model with the users?
I tried looking into the Orchard.Users module, but the adminController there seem to have more objects exposable than in my HomeController. 

Thanks in advance,


May 8, 2011 at 8:53 PM

Hi Martin,

You should be able to do this using Orchard.Users. You might want to look at the Profile module in orchard gallery, it allows users to have profile pages, I'm not sure if it already provides a users list.

A good example for you to look at is Orchard.Core.Routable.Controllers.ItemController - you can see there how it's loading and displaying an item. Users are also just content items so you can do the same thing.

The extra objects on AdminController are instanced via dependency injection, you just need to make your constructor the same as that one and you'll get those objects.

May 9, 2011 at 7:49 AM

thanks for the advice randompete. I will surely look into the profile module. Can only work on this in weekends so I am already looking to the weekend!

May 9, 2011 at 5:24 PM
Edited May 9, 2011 at 5:27 PM

Just had a quick look at it and the parameter object implementing IMembershipService which passes to the constructor of the controller only exposes a GetUser(string username) member. In my case I want to get a list of users in a specific role (lets say TeamMember is a role).

Does that mean I have to modify the IMembershipService interface and write my own implementation of a GetUsersInRole (like IUser[] GetUsersInRole(string username); ) ?

Guess I have to do some overriding in the Core.. This sounded difficult. Am I on the right track?

May 9, 2011 at 5:31 PM

You should never need to work directly in core. Everything should be replaceable from your own modules and themes. And in this precise case, I don't think you even need to do that. You should be able to query users and roles like any other content items, through ContentManager.