I am trying to: Receive notifications when a form is submitted
Link to a page where the issue can be seen: hidden link
I expected to see: A notification
Instead, I got: Nothing
We stopped receiving CRED notifications around 5 April. Up until then they have been working fine. I have sent test emails and they work fine so I don't think they are being blocked. I have tried re-saving the form but that hasn't helped. The only thing that I can think that has changed around this timeframe was a wordpress update to 4.9.5 - are you aware of any conflicts here?
The really strange thing, is that we have a staging site which is an exact replica of the live site, and these notifications work fine, the only difference between the sites that I can think of is that the staging site doesn't have an SSL certificate.
Okay so you're saying that the notifications ARE working on staging, but ARE NOT working on production, correct? I'm not aware of any conflicts in WP 4.9.5, so there must be something else going on. Are the staging and production environments identical in terms of PHP version, server engines, extensions, etc.? If so, then I can think of a few things to try in production:
- Temporarily activate Maintenance Mode, then deactivate all plugins except Types, Views, and CRED. Activate a default theme like Twenty Seventeen. Test notifications again.
- If the problem is resolved, then reactivate your theme and other plugins one by one until the conflict is revealed. There may be a configuration setting that can be tweaked in that plugin to re-enable notifications. Sometimes simply disabling cache on a file may resolve the problem.
- If the problem was not resolved, then I recommend checking the server logs to see if any errors are triggered by the CRED notification process. If you're not familiar with server logs, I can show you how to activate them. Go in your wp-config.php file and look for define(‘WP_DEBUG’, false);. Change it to:
define('WP_DEBUG', true);
Then add these lines, just before it says 'stop editing here':
ini_set('log_errors',TRUE);
ini_set('error_reporting', E_ALL);
ini_set('error_log', dirname(__FILE__) . '/error_log.txt');
Submit the CRED form again to trigger the notification process. Then check the root folder of your website using FTP and look for a file called "error_log.txt". If any errors were triggered, this file will exist. Send me its contents. Then you can revert the changes in wp-config.php.
Thanks for getting back, I'll follow this up and get back to you. I'll also check with my host to make sure there's nothing obvious on their end and ask if there are any differences between the staging and production environments.
Sounds good, I will mark this ticket as pending an update from you and we can pick up when you have more information.
Hello, just to keep you in the loop. Our host has pinpointed the issue to when their object cache is enabled (the forms work ok when they disable it). That must be the difference between the staging and live environments. They are currently trying to debug the forms to understand why. Is this something you have come across before?
thanks
Can you tell me what type of object caching system is used in production? I can ask my developers for more information about it.
They've got back to me and said..."The object cache we use is REDIS and we use a slightly modified version of Author: 34SP.com Original authors (Matthew Boynes, Alley Interactive) PHP redis object-cache file."
Hope it helps.
Okay thanks, I will pass this information along and see what we can figure out. I'll update you when I have some feedback to share.
Hello, our host has gone as far as they can with debugging, here's what they suggested I pass on to you in case it helps...
./application/controllers/notification_manager.php:
$notification = isset($data['notification']) ? $data['notification'] : false;
if (
( ! $attached_data && ! $is_user_form )
|| ! $notification
|| ! isset( $notification->enable )
|| ! $notification->enable
|| empty( $notification->notifications )
) {
error_log( print_r($notification, TRUE). "notification called\n", 3, "*URL REMOVED*/keith.log");
return;
}
The above if statement is triggering and it is returning without sending the notification.
Below is the contents of $notification
triggerNotifications called
stdClass Object
(
[enable] => 1
[notifications] => Array
(
[0] => Array
(
[event] => Array
(
[type] => form_submit
[post_status] => publish
[condition] => Array
(
)
[any_all] => ALL
)
[to] => Array
(
[type] => Array
(
[0] => specific_mail
)
[wp_user] => Array
(
[to_type] => to
[user] =>
)
[mail_field] => Array
(
[to_type] => to
[address_field] =>
[name_field] =>
[lastname_field] =>
)
[user_id_field] => Array
(
[to_type] => to
[field_name] =>
)
[specific_mail] => Array
(
[address] => *EMAIL ADDRESS REMOVED*
)
)
[from] => Array
(
[address] =>
[name] =>
)
[mail] => Array
(
[subject] => %%FORM_NAME%%
[body] => <p>%%FORM_NAME%%</p>
<p>%%POST_ADMIN_LINK%%</p>
<p>%%FORM_DATA%%</p>
)
[name] => TIC Notification
)
)
)
My 2nd tier team hasn't been able to find any known issues related to this, so they have requested a copy of the site. I can log in and install the Duplicator plugin to create a clone of the site, or you can provide a zip archive containing a SQL dump of the database, wp-content/themes and wp-content/plugins folders. Let me know how you would like to proceed.
Hello, unfortunately I'm not able to give access to our server and duplicator fails with our hosting provider as they use non-default wordpress paths. I would imagine it would be difficult to replicate anyway as it seems to be some combination of the plugin and the hosting environment that's causing the issue.
Sadly it looks like we're going to have to find a different solution for forms as the notifications seem to work fine for another plugin I've tested.
Thanks for looking into it.
I understand, I would be glad to run some tests on a SQL dump file and a backup of the themes and plugins folders. That would not require access to your server, and I could verify that there's nothing else we have overlooked that could be causing the problem. Let me know if you would like to proceed, or we can close out this ticket.
Hello, thanks I'll close this ticket for now while we investigate other options. We also need to make sure our forms are GDPR compliant so we can make both changes at the same time.
Thanks