Notificiations API - Writing to Log Has Stopped Working

I’m working on a fairly complex API Notifications integration. I was testing the Notifications API using a log file. This was working prior to updating to WordPress 4.7.1. Frankly, I thought I’d broken something, but I went back to basics today, using the test code found in the s2Member KB.

The only thing I changed was adding the code below (also found in the above KB article) to write to a log file:

file_put_contents(WP_CONTENT_DIR.'/plugins/s2member-logs/my.log', 'Payment Notification Received for User ID: '.$user_id."\n", FILE_APPEND);

I know the Notifications API is firing because I’m receiving the email notification. Unfortunately, that email does not send a log of the transaction but a preformatted email. I guess I’m going to have to look for that email template and change to send the log of the transaction if I can’t figure out why the log file isn’t working. I don’t need the log file, but I need to know that my parameters are being passed…

Has anyone seen a problem like this? I don’t what would have changed with WordPress 4.7.1 to cause this , but that’s the only thing that is different between this code working on the 12th of January and not working now. All of my other log files are being written to properly which makes this all the more confusing and frustrating.

I had actually made it to a fairly complex notification before it broke…

I don’t know if it’s related, Pat, but I do know that WP 4.7.1 broke MIME type checking so badly that they have had to bring out a plugin as a temporary workaround. Maybe that might work for you too. See https://wordpress.org/plugins/disable-real-mime-check/

Thanks, Tim!

That didn’t fix the log problem (still not writing to the log), but it did fix the email. The email wasn’t picking up my extra parameters without the plugin, but it does now. That’s really all I need: to be able to see that my parameters are being passed.

I opened a GitHub issue about this, just in case it is not just me not holding my mouth right.

Note: The email sent all the parameters exactly once. I didn’t even change anything the second time I tried. It is now just sending the standard s2Member information (none of my custom parameters.)