The Problem
We troubleshoot and review a good amount of forms for Gravity Forms users, and I was recently annoyed that I could not quickly access the logs from the entry details page. Instead, you would need to go to Forms > Settings > Logs, which is a few too many steps when you’re in a hurry.
I thought the entry details page would be a smart place to have a button since the notes section on that page is often the first place a user would look for an indication of an issue.
How To Fix It
I initially wanted to add the button to the notes section, but decided it would be best to keep the button separate and instead added a new meta box to the page.
As you can see, this solution only displays a button for the core log files. With some code modification, you could add a button for any add-ons with enabled logging.
This is the code that makes this possible:
How To Implement This Code
Copy and paste the code above to your themes functions.php file or use a code snippet plugin like WPCodeBox.
You do not need to make any modifications, but logging will need to be enabled. If it is not, instead of a button, you will see this message: “Log file not found.”.
If you wanted to make this a separate plugin, you could do that as well.
- Create a new folder (directory), name it gr-log-button
- Create a new PHP file with that folder/directory, name it gf-log-button.php
- Copy and paste the plugin header below to the file.
- Copy and paste the code above to a file below the plugin header.
- Save your changes.
- Zip up the file.
- Upload the file via the WordPress plugin installer.
- Activate the plugin.
<?php
/*
Plugin Name: GravityRanger GF Log Button
Description: Adds a button to view Gravity Forms core log file within the entry details page.
Version: 1.0
Author: Chris Eggleston
Site: https://gravityranger.com
*/
Need More Help?
If you run into issues with this code or have any questions, please use the comments below, and we’ll be sure to get back to you.