Skip Navigation

[Resolved] CRED notification from Form A sent, when Form B is submitted

This support ticket is created 5 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

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.

Our next available supporter will start replying to tickets in about 7.92 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Tagged: 

This topic contains 4 replies, has 3 voices.

Last updated by dougW-4 5 years, 1 month ago.

Assisted by: Christian Cox.

Author
Posts
#1356055

I am trying to:
Hello, this is a tricky bug I've run into. I have 2 forms. Form A is created by a contributor submitting information. This looks like a pretty standard post form, with some checkboxes and custom fields. When it's submitted, depending on what is selected it may email a notification to a supervisor.

That supervisor is able to look at an archive page of all the submitted posts. Next to each post is Form B, a small form that is just one button. The button "approves" the post and sets some hidden fields. This form has no notifications built on it.

The problem is that when Form B is submitted, it is resending the notification from Form A to the supervisor, causing confusion.

Link to a page where the issue can be seen:
This is behind a password protected portion of the site, and tightly controlled firewall. I could give you a screen share of the site, but can't give you direct access 🙁

I expected to see:
I expect there to be no notification when this form is submitted, but an email comes through. This only seems to have started occuring since updating from CRED 1.9 to the current versions.

Instead, I got:
Supervisors receive a second notification that is confusing them.

Thanks for any help! My feeling is that there is some residual code left over from updating versions causing this notification to be sent out but doesn't appear in the list of notifications.

#1356189

The notifications are not only bound to a form but to events, in general.
So if both forms trigger both the same events the forms will both send that notification, or better, the forms will trigger that notification.

Let's say you have a form wit notification sent when post is published.
The form does publish the post, and send the notification.
If now another form for some reason is also publishing that post (or basically, triggering the same event), AFTER the post was created or edited with that other form setting the notification, it will also trigger it again.

I suspect this is the case here.
Can you check what the condition to send the notification is, and wether the other form triggers that same condition?

#1356265
notifications.png

Oh my, that is exactly what is happening! Thank you for the clarification! I wish that wasn't how it functioned, but this explains a lot of the behavior I've been noticing. Is there anyway to prevent it from sending other form's notifications?

This makes me think that if I have multiple forms editing the same post type, I should put all my notifications within one primary form to keep things simple. Is that what you would recommend?

The Form A is set to only send a notification if certain fields are set (if it's marked as 'approved' and a checkbox has been checked). My issues would mostly be resolved if it only sent the notification when the value was changed. However, I have tested that in the past and got inconsistent results. Is there some documentation to explain in more detail how those conditions are met?

Thank you so much for you help!

#1356523

Is there anyway to prevent it from sending other form's notifications?
You can create custom notification events with our PHP API, and add your own logic testing the Form ID. We have documentation about custom notification events here: https://toolset.com/documentation/programmer-reference/cred-api/#cred_custom_notification_event_type_condition
And a practical example here: https://toolset.com/forums/topic/cred-form-notification-email-conditional-on-generic-field/

This makes me think that if I have multiple forms editing the same post type, I should put all my notifications within one primary form to keep things simple. Is that what you would recommend?
That could be a way to simplify things, if it works for your site's workflow.

Is there some documentation to explain in more detail how those conditions are met?
They should be fairly self-explanatory, but if something doesn't seem to be behaving as expected, I can take a look at any specific case and give you some feedback. There are currently some open issues to be aware of involving email notifications triggered by custom field changes:
https://toolset.com/errata/forms-notifications-always-sent-when-its-condition-depends-on-a-radio-field/
https://toolset.com/errata/issues-with-form-notifications-for-posts-created-or-edited-in-the-backend/

#1358409

Great information. I'll continue to refine these notifications. Thanks