I have the following scenario:
1. User A adds a project (custom post type) on the platform that this person worked on
2. Now this person could have worked on the project alone or with people. Our actions will change based on that.
3. If User A was the only person working on the project we are good. No help is needed.
4. If User A collaborated with people on the project, things get interesting - the User A should be able to add other collaborators to the project with their email Ids, names, and roles.
5. When the user submits the project, these collaborators should receive a notification that they have been added to the project by User A.
6. Now let's call these users User B, User C, and User D.
7. Now user B is already a registered user but user C and User D are not registered on the platform.
8. When user B logs back in they see the project as one of their projects i.e. it is visible on their portfolio (another custom post type) which uses the logic of the same author to show related posts.
9. When User C registers, they also see the project on their portfolio with the role assigned to them by User A. Now, they should be able to edit the role if they want by going to the project. That update should inform all the Users A,B, C,D that the project was updated.
10. When a user visits the project, they should be able to see the avatars of all 4 users on the project in a loop that clearly listed roles.
Why is this important?
People collaborate to work on projects and this is a way to give credit to one another for their work and value them.
My questions are
1. How can I capture email, name, and roles next to one another for the user while creating a project?
2. Do I need to just add custom fields to capture this information or I create a custom post type called collaborator that forms an O2M relationship with the project post?
3. How do I restrict the edit rights to all people that are collaborators. Is there a way to give the original author master edit rights that restrict others from changing anything else except their own role in the project?
I am most unsure of how to map the information in a scalable way for email, name, and role so that all three are linked together while allowing the original author to add multiple collaborators in one form.
Hello,
In your case, it needs to setup many-to-many relationship between Person and Project, you can try these post type structure:
1) Setup two post types:
- Person (each Person post's author is different user role), with below fields:
email Ids, names
- Project
2) Setup many-to-many relationship between Person and Project, in the intermediate post type, add custom field "Role"
So you can connect one Project post with multiple Person posts, and assign different role field value.
In each single Project post, you can display related Person posts.
In each single Person post, you can display related Project posts.
More help:
https://toolset.com/course-lesson/how-to-create-custom-searches-and-relationships-for-users/
This sounds good. Thanks for sharing. I have a follow-up:
How do I capture name, email, and role information on the project creation form for multiple collaborators?
It is like a multiple value field but with three sub-fields. Is there a way to group the fields for one collaborator and then allow the user to add another collaborator? Just like how multiple value fields work on Toolset with a + sign?
Collaborator A: Name, Email, Role
Collaborator B: Name, Email, Role
and so on....
It is a bad user experience to ask users to add collaborators individually on a new form. Image if there are 5 collaborators, the user would have to submit 5 collaborator forms. They would probably get tired and not do it.
For the question:
How do I capture name, email, and role information on the project creation form for multiple collaborators?
As I mentioned above:
email Ids and names custom fields are in post type "Person", so you need to setup post forms for creating "Person" to capture those two custom field values.
"Role" field is in intermediate post type, you will need to setup relationship form capture it:
https://toolset.com/course-lesson/front-end-relationship-forms-for-connecting-posts/
For the question:
Is there a way to group the fields for one collaborator and then allow the user to add another collaborator?
One post form can handle only one post, since it is many-to-many relationship, you need to use relationship form to connect posts, there isn't such kind of built-in feature to merge them into one post form within Toolset plugins.
Luo,
I can write custom code to match the relationships in the backend and take data from the form and use hooks to store data and all.
What I need is a user-friendly way to input data in the same form as the project submission form. Can I use something like a repeatable field group to make it happen or use the generic fields and custom form settings to allow user to add data for each collaborator?
Toolset Repeatable field groups are based on one-to-many relationship, so each child item of Repeatable field groups is also a single post, you still need to use another post form to setup the child items, see our document:
https://toolset.com/course-lesson/front-end-forms-for-repeatable-field-groups/
So there isn't such kind of built-in feature within Toolset Forms plugin