Este hilo está resuelto. Aquí tiene una descripción del problema y la solución.
Problem:
The issue here is that the user wanted his users to be able to subscribe to a notification type. Lets say the user has a Job type and wants to notify user when they subscribe to a notification of a particular job type.
Solution:
This can be done by creating a secondary CPT for the notifications where the user can create the notification type they want for a job.
So on this notification cpt it should have attributes from the Jobs CPT that can be used to match a notification for a Job type. The notification CPT must also have an email field.
Then you can use this code below to send an email to a notification post based on a matching custom field criteria.
Hey there i want to built an E-Mail Alert.
My Parent post type is Jobs. Jobs have custom fields (e.g. location: Berlin/London and contract: fulltime/part-time ) which describes the job.
Now I want a child post "E-mail Alert"! the Email alert should have the same fields like the Jobs post.
User saves a E-Mail-Alert (child) with the fields
location: Berlin
contract: fulltime
The user gets an E-mail when a new Job is published with the same attributes:
location: Berlin
contract: fulltime
Maybe i should explain in more details what i try to do:
Employers (User role A) can post Jobs (Custom post type).
Jobs have a Jobsform with multiple different fields e.g. "work".
The field "work" has lets say two options to select: "Fulltime" and "Part-time".
Allright, the employer publishes his job with tag "Fulltime".
Now i have candidates (user role b). The candidates should get notified everytime a new job is published depending on the tags the job is published with (in this case: "fulltime")
So, candidates should save Job-alerts (Email is send everytime a new job is posted). The job-alert is in a many to many relationship to the jobs.
The form of the job alert should reflect the same options like in the job form.
This means a candidate selects the tag "fulltime" and saves it. Now everytime a job is posted with the tag "fulltime" this candidate should get an E-Mail notification that a new job is posted to his query.
Its like an subscription to get notified when a new fulltime job is published.
So its pretty much like this. Role A creates the Jobs, Role B can Apply or get notifications of the Job creations based on a predefined criteria in a child post that Role B creates
Thanks for confirming, so I have a bit of bad news on this one as it will require some amount of custom code.
The reason is that the notifications are independent of each other, this means that the CPT that the form is creating, thats what the notification is tied to. You wouldn't be able to send Job creation notifications to persons who created the child posts.
This might be possible with custom coding but it isn't with our product out of the box.
but one question before trying this out. Is this just a subscription to the post type or can i match the taxononmies or custom fields to it.
So a user fills out the subscription form and wants only get notified when the fields or taxonomies are matching with the post type. like in the subscription form select taxonomy: fulltime - the user gets only notified when the post type hast the fulltime taxonomy.
great and thank you for being so patient with me ;-).
I will set the post types and fields up and give you a shout when i am ready. Can we check (criteria) only taxonimies or every custom field?
So it would make sense in the case of a job post to only get emails in the area the user has selected.