Created
March 22, 2016 17:52
-
-
Save adrianosferreira/ca3cbe3e2ab49935e12b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This will let you add a custom event for your notification | |
* If the custom field is equal today the notification will be triggered | |
*/ | |
add_filter( 'cred_notification_event_type', 'my_custom_event_type', 99, 4); | |
function my_custom_event_type($notification_type, $form_id){ | |
if( $form_id == '123' ) | |
return 'data_custom_field'; | |
} | |
add_filter( 'cred_custom_notification_event_type_condition', 'my_custom_event', 99, 4) | |
function my_custom_event( $bool, $notification, $form_id, $post_id ){ | |
if( $form_id == '123' ){ | |
$date_field = get_post_meta( $post_id, 'wpcf-my-date-field', true ); | |
$current_date = date('Y-m-d'); | |
if( strtotime( $current_date ) == $date_field ) | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Missing ";" on line 12. :)