Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gw-update-posts.php: Fixed an issue with confirmation message not displaying. #725

Merged
merged 2 commits into from
Nov 11, 2023

Conversation

saifsultanc
Copy link
Contributor

Context

⛑️ Ticket(s): https://secure.helpscout.net/conversation/2402316918/56523?folderId=3808239

Summary

When the Update Posts snippet is active on this user's form, the confirmation message doesn't display after submitting the form.

We disable wp_update_post param $fire_after_hooks to ensure we do see the confirmation.

Confirmation message setting on form:
Screenshot 2023-10-31 at 2 10 06 PM

BEFORE:
Screenshot 2023-10-31 at 2 09 23 PM

AFTER:
Screenshot 2023-10-31 at 2 09 35 PM

@saifsultanc saifsultanc added the bug Something isn't working label Oct 31, 2023
@spivurno
Copy link
Contributor

@saifsultanc Why does this fix the issue?

@claygriffiths
Copy link
Contributor

@saifsultanc I am equally intrigued 😂. If this is the best path can you add an inline comment explaining why the params are there so we don't forget?

@saifsultanc
Copy link
Contributor Author

Sorry guys. Updated with the comment.

@spivurno
Copy link
Contributor

spivurno commented Nov 3, 2023

@saifsultanc I'm still looking for a better understanding of why this resolve the issue? The comment you've added describes what is failing but not why it was failing and how disabling the hooks resolves that.

@claygriffiths
Copy link
Contributor

Doing a bit of research, that parameter determines if wp_after_insert_post() is run, which runs the wp_after_insert_post action.

Interestingly, Gravity Forms does not use this hook and there are very few usages in WordPress that are added to this hook.

The only other thing that I'm wondering if the issue could be related to is the get_post() call in https://developer.wordpress.org/reference/functions/wp_after_insert_post/#source which might be some sort of weird caching issue?

@claygriffiths
Copy link
Contributor

Admittedly, the logic around confirmations is quite complex, and I'm sure I could understand this with a 30 minute Xdebug session, but it's not worth the time if this resolves the issue for the customer.

@spivurno
Copy link
Contributor

@claygriffiths @saifsultanc I'm ok with moving forward with the existing solution. Let's just make it clear in the comment that this is a bit of voodoo so if there's an issue in the future we know we can challenge this parameter.

@saifsultanc
Copy link
Contributor Author

@claygriffiths @spivurno It was more of a hit and trial with different possible permutation to get that. I could debug to WHERE the issue was. Rest was to lookup documentation of wp_update_post and see what else that I can do without breaking current functionality and resolving the issue.

@saifsultanc saifsultanc merged commit d0ea3e5 into master Nov 11, 2023
@saifsultanc saifsultanc deleted the saif/fix/56523-fix-gw-update-posts branch November 11, 2023 01:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging this pull request may close these issues.

3 participants