Skip to content

Fix: uploaded PDF/DOC/TXT files not displayed in entries single view#1571

Open
saurab018 wants to merge 1 commit into
pre-developfrom
EVF-2469-uploaded-pdf-doc-txt-files-not-displayed-in-entries-list
Open

Fix: uploaded PDF/DOC/TXT files not displayed in entries single view#1571
saurab018 wants to merge 1 commit into
pre-developfrom
EVF-2469-uploaded-pdf-doc-txt-files-not-displayed-in-entries-list

Conversation

@saurab018
Copy link
Copy Markdown
Contributor

@saurab018 saurab018 commented May 21, 2026

All Submissions:

Changes proposed in this Pull Request:

Fixes a bug where uploaded files (PDF, DOC, TXT, ZIP, etc.) upload successfully and appear in notification emails, but are not visible in the WordPress admin entry single view.

Root cause: The entry-single view template passes $meta_key to the everest_forms_html_field_value filter but the filter was registered to accept only 4 arguments, so the meta key was never received by the upload class. Without it, html_field_value() fell back to array_search( $val, $form_data, true ) with strict comparison, which silently returned false when esc_html() had altered the file URL — causing all files to be skipped and the field to render blank.

  • Pass $meta_key as 5th argument to everest_forms_html_field_value filter in the entry-single view template
  • Increase add_filter accepted args from 4 to 5 in class-evf-form-fields-upload.php
  • Add $field_meta_key as 5th parameter to html_field_value() and use it directly for meta key resolution in entry-single context
  • Add missing continue after setting empty $output[$meta_key] to prevent a string/array type conflict on subsequent loop iterations

Closes # .

How to test the changes in this Pull Request:

  1. Create a form with a file-upload field and submit an entry with a PDF, DOC, or TXT file
  2. Go to WP Admin → Everest Forms → Entries → open the entry single view
  3. Verify the uploaded file displays as a clickable link with the filename
  4. Verify email notifications still display the file correctly
  5. Verify the entry table list view still displays files correctly

Types of changes:

  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (modification of the currently available functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you successfully ran tests with your changes locally?
  • Have you updated the documentation accordingly?

Changelog entry

Fix: Uploaded files (PDF, DOC, TXT, etc.) not displaying in the entry single view in WP admin due to fragile meta key resolution via strict array_search comparison.

- Pass $meta_key as 5th arg to everest_forms_html_field_value filter in
  entry-single view template so the upload class receives it directly
- Accept $field_meta_key as 5th parameter in html_field_value() and
  increase add_filter accepted_args from 4 to 5
- Use passed meta_key directly in entry-single context instead of
  fragile array_search() with strict comparison, which silently failed
  when esc_html() altered the URL string
- Add missing continue after setting empty output to prevent
  string/array type conflict on subsequent loop iterations
@saurab018 saurab018 force-pushed the EVF-2469-uploaded-pdf-doc-txt-files-not-displayed-in-entries-list branch from 1e6b5e3 to 1030f65 Compare May 21, 2026 10:09
@saurab018 saurab018 self-assigned this May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant