You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit addresses issues in the contact form email functionality
when the "Save responses" toggle is disabled. The changes ensure that:
1. Method signature enhancement: Added an optional $response parameter
to get_compiled_form_for_email() to allow passing response data
directly instead of always fetching from database
2. Conditional response fetching: Modified the method to only fetch
response from database when not provided as parameter, preventing
errors when no feedback ID exists
3. Defensive URL building: Added checks before building dashboard URLs
and spam marking URLs to handle cases where $post_id is null (when
responses aren't saved)
4. Conditional metadata storage: Added guard clause to prevent storing
feedback email metadata when no post ID exists
5. Safe nonce generation: Added null check when generating nonces to
avoid issues with missing post IDs
6. Action button handling: Made the "View in dashboard" action button
conditional on having a valid dashboard URL
These changes ensure the email notification system works properly
regardless of whether form responses are being saved to the database or
not.
0 commit comments