[Deprecated] Fix lightbox links not being added to images
If you use GravityView 2.10 or newer, this article is not relevant. GravityView now uses a different lightbox script that supports Gravity Form's secure download links.
Version 2.1.1 of Gravity Forms added security improvements that affect the lightbox GravityView uses.
GravityView supports Gravity Forms' secure download locations, which hide where a file has been uploaded. This is good for security, but it affects how the lightbox script works.
Option 1: Use a different lightbox script
GravityView uses the default WordPress lightbox script called Thickbox. Thickbox doesn't support these secure links, but other lightbox scripts do.
Option 2: Disable the secure paths when displaying GravityView images
To use lightbox script with images in GravityView, add the following code to your theme's functions.php file:
add_filter( 'gform_secure_file_download_location', '__return_false' );
Adding the code above will direct GravityView to use the insecure path to the image when displaying it. Note how the secure link doesn't show the name of the file, but the insecure link does:
- Secure: https://www.example.com/index.php?gf-download=2018%2F11%2F864260e1-b0af-4f61-b798-b6ff0b1d49931.jpg&form-id=1&field-id=4&hash=409bda81bdd179545da1512e9e06ab1753104582a52bedeeaac04f8366e2c264
- Insecure: https://www.example.com/wp-content/uploads/gravity_forms/864260e1-b0af-4f61-b798-b6ff0b1d49931/2018/11/name-of-your-file.jpg