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.
//Job Alarm function add_action('cred_submit_complete', 'my_success_action',10,2); function my_success_action($post_id, $form_data) { if ( $form_data['id'] == 67) { $job_type = get_post_meta($post_id, 'wpcf-position-normal',true); $job_stelle = (types_render_field( 'stelle-ist-geeignet-fur', array( 'id' => ''.$post_id.'') )); $notifications = get_posts('post_type=job-alarm'); foreach ($notifications as $notification) { $email = get_post_meta($notification->ID, 'wpcf-e-mail', true); $notification_type = get_post_meta($notification->ID, 'wpcf-position-alarm',true); $notification_stelle = (types_render_field( 'stelle-ist-geeignet-fur-alarm', array( 'id' => ''.$notification->ID.'') )); if ( $job_type == $notification_type && count(array_intersect(explode(",",$job_stelle), explode(",",$notification_stelle))) > 0) { wp_mail($email, 'Dein Job Alarm: '.get_the_title($post_id), get_permalink($post_id)."HTML CODE CAN GO HERE"); } } } }
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | - |
- | 13:00 – 18:00 | 13:00 – 18:00 | 13:00 – 18:00 | 14:00 – 18:00 | 13:00 – 18:00 | - |
Supporter timezone: America/Jamaica (GMT-05:00)
Dieses Thema enthält 61 Antworten, hat 2 Stimmen.
Zuletzt aktualisiert von vor 6 Jahren, 2 Monaten.
Assistiert von: Shane.