I have a Types setup for a recruitment agency like this:
1. Four CPTs: candidate / employer / job-post / job-application
2. candidate, employer, and job-post CPTs each have its own custom fields group. job-application does not have any.
3. candidate is parent to many job-application. employer is parent to many job-post. job-post is parent to many job-application
4. job-application is just a "bridge" CPT to build many-to-many relationships between candidate and job-post
What I need to achieve:
I want to put a button that says "Apply to this job" on single job-post pages which will allow signed-in candidates to apply to the job they're currently viewing.
When users first register with the site, I automatically create a "candidate" CPT with the details they've submitted and assign their newly created user account as the author of their "candidate" CPT. So, each user has only one candidate CPT assigned to them.
Now, I just need the "Apply to this job" button to create a new "job-application" CPT and make it a child of the currently viewed job-post as well as a child of the candidate CPT of the currently signed-in user. I don't need users to fill any additional form. They can just receive a success message or be redirected to another page after hitting that button.
How can I do this with CRED? Or maybe I don't need CRED at all for this?