Hey, I have built a custom HTML form that submits to GF. Up until a couple of days ago, everything was working perfectly and without problems… Now all of a sudden, I have a problem when sending notifications using GFCommon::send_notifications() function.
In my PHP, upon form submitting I’m sending 3 notifications using GFCommon::send_notifications - 1 for the user, 1 default and 1 to the admin. All of a sudden without changing nothing the admin one is not working. The notification that is sent to the user is OK, the default one is OK too, but the one to the admin fails… Since I’m taking the NID through AJAX I tried with hard coding the NID in the function and again it fails. The admin notification is routed based on field in the form (ex. Field 1 is A, send to a@email.com, Field 1 is B, send to b@email.com)… Is there any major changes to the GFCommon::send_notifications function or to the routed notifications with last release? I didn’t find anything… In my form entry I’m getting “WordPress successfully passed the notification email to the sending server.” for the user notification and the default notification, but the admin notification doesn’t even shows up there… Besides hard coding the NID, how else I could test where the problem is? It’s a bit weird that for the other 2 notifications is working, but it’s failing for the admin one…
There have been no changes to those functions in several years. I recommend checking that you have a routing rule defined for the value that the entry contains when you trigger sending. If there isn’t a matching rule then sending will abort early.
Hi, the routing is done inside GF, I have checked and the fields that the routing is based on are getting the required values, also I have tested this with a normal notification witouth the routing and it still fails.
Here is my exact piece of PHP code that sends the notifications.
Here the admin notification just fails, the form is submitted, the entry is created, the user and the default notifications are sent, but the admin notification doesn’t even appear in the entry notes. Even when I hard code all 3 NID’s, the admin one fails and the other two work… Tried with Logging, but didn’t saw any errors there…
As you can see there 3 lines of exactly the same code - 2 of them work, one doesn’t…
Here are screenshots from GF admin showing the routing:
The first argument of GFCommon::send_notifications() requires an array of notification IDs to be sent, not the properties of a specific notification. Try the following approach:
Hi, yeah, that seems to fix my issue. Thanks! It’s also cleaner as a solution, passing the NIDs as array. But how come “my way” without passing the notification IDs as array was working until a couple of days ago?