Hi @ergopix,
Thanks for your message.
No changes have been made for a while however, you may find this support document on the subject helpful: https://betternotificationsforwp.com/documentation/how-to-trigger-a-notification-from-an-acf-front-end-form/
Let me know how you get on?
Hi!
Thanks for your answer but it doesn’t change with this code. From backend it’s OK but front not.
Hi @ergopix,
Did you change the code to cater for your post type, post status, etc?
I’ve tested it on multiple sites and whenever there’s been an issue with a notification not sending when submitted (or edited) via an ACF front-end form, it’s worked really well.
I’ve this:
$settings = array(
post_title’ => true,
post_id’ => ‘new_post’,
uploader’ => ‘basic’,
new_post’ => array(
‘post_type’ => ‘post’,
‘post_status’ => ‘private’
),
submit_value’ => __(“Ajouter”, “ergopix”)
);
acf_form($settings);
And:
function bnfw_after_save_post_pending($post_id) {
$post = get_post($post_id);
$post_type = get_post_type($post_id);
$old_status = $post->post_status;
if ($post_type === ‘post’ && $old_status === ‘private’) {
global $wpdb;
$bnfw = BNFW::factory();
remove_action( ‘pending_submissions’, array( $bnfw, ‘on_post_pending’ ), 10, 2);
wp_update_post(array(
‘ID’ => $post_id,
‘post_status’ => ‘private’
));
}
}
@ergopix Thanks.
I think you may need to change a couple of things in your code in order to get it working:
- You need to set the post to move from draft to private.
- On line 15 of the second code block on that support document, you need to change it to your post type and post status.
I’m unable to help with specifics custom code so you may need to ask a developer to help you with this if you can’t get it working – hope the above helps though.
Thank you! Everythings is OK!
Hi @ergopix,
Great! Glad you got it working.
If you like BNFW and the support, please feel free to leave an honest review.