Use Case : Registration of a Team for some event

by shivams   Last Updated January 10, 2018 21:07 PM

Here is my use case:

The users can register for the website and then form TEAMS. One of the users would be the TEAM LEADER. The team leader can register for various events for his/her team(s). When the team leader registers his/her team, all the TEAM MEMBERS automatically get registered.

Now, how to implement the above functionality? That is:

  1. How do I implement the formation of teams?
  2. How do I implement the registration of the whole team entity for some event?

How is event registration handled?

For events, I have a content-type event. The registration for event can be done using two approaches. Either using flag module, or making a registration content type and using references (and nodereference-url) module. I haven't finalized on the approach yet.

Furthermore, I'm thinking of using OG module for team formation, but I'd like to avoid that as it'd be an overkill.

Kindly suggest approaches for my use case.

Thank you in advance.



Answers 1


What you just described can indeed be implemented in various ways but it really depends on how you have architectured your website. Here is how to do it using relation angway:

Use relation module

After installing relation, Create a relation type and name it something like is member of and it's reverse has member. The relation will be from user2user and with arity of 2.
I wouldn't suggest using any other configuration, such as using a single relation from leader to all members. Later it will cause you more pain.


The Membership

I don't know. How does your website work? how does one request to be member of a group? many of these concerns are addressed by OG already.


The registration workflow

Create another relationship registered at relation, from user to the entity type representing the event (the node if it is a node). Use the module rules_link or rules_pane. Create a rules component: register at event that takes two arguments: event node and registering user.

In this component you have to add:

  • Action: Create a list of any entity type.

    • name it rel_list.
  • Action: Add an item to list.

    • list:rel_list
    • item:node_event from component arg.
  • Action: Add an item to list

    • list:rel_list
    • item:registering_user from component arg.
  • Action: Create an entity

    • of_type:relation
    • of_bundle:registered_at

From your rules_link or rules_pane call this component and feed it current user and the corresponding node. The created relation entity is an indicator of membership, for leader only!

Add another component: Fetch team members, it's arg: leader user, it will provide: list of users->members. write a custom rule fetch team members and query all members using EntityFieldQuery or use the module efq_rules to fetch team members. for each queried user, use the above component to create the relation.
you definitely want to have rules_conditional installed.

Central Place for storing memberships.

Instead of a direct relationship from leader to team members you might want to have a node representing the team and create relations from this node to users. this way if you needed to change the leader it can be easily done with removing the is leader of relation and creating a new one to the new leader. But then, having this central entity, why not make it an organic group?

I usually choose relation when I need a fine grained control over memberships.

loolooyyyy
loolooyyyy
October 05, 2014 16:40 PM

Related Questions





Display block only for og subscribe

Updated March 23, 2017 11:07 AM

Get Organic Group roles of the current user

Updated May 28, 2017 13:07 PM