perfecty-push-wp
perfecty-push-wp copied to clipboard
Multiple notifications on post updating
Hi, I've find out that if I set on "true" the toggle for notification on post publishing, any other action without reloading the page (like a post updating action) ends in another push notification sent. If the page is reloaded, no further post notification happens, so it's like that the toggle keeps stay on and sends notifications. This happened to me on 4 sites, 3 of mine and 1 of a friend, so this seems to be an issue not related to my use or configuration (except for Varnish that we both use).
Is it possible to set a time limit before multiple notifications can be sent for the same post?
Hi @matteomorreale, the notification is send if the "Send notification on publish" checkbox is checked. In the old WordPress editor the save button performed a page submit which caused the page to be refreshed and the checkbox to reset, however in the new Gutenberg editor (or Block editor), the save is done via Ajax, and thus the webpage is never reloaded and the checkbox remains checked.
The solution would be: detect if in the Gutenberg editor the post is being saved and uncheck the "Send notification on publish" box. This needs to be done in the Client side (Javascript), so we might need a subscribe to the isSavingPost or isAutosavingPost events like:
https://wholesomecode.ltd/blog/hook-save-action-wordpress-gutenberg/ https://wordpress.stackexchange.com/questions/319054/trigger-javascript-on-gutenberg-block-editor-save
FYI @MocioF
Hi @matteomorreale, the notification is send if the "Send notification on publish" checkbox is checked. In the old WordPress editor the save button performed a page submit which caused the page to be refreshed and the checkbox to reset, however in the new Gutenberg editor (or Block editor), the save is done via Ajax, and thus the webpage is never reloaded and the checkbox remains checked.
The solution would be: detect if in the Gutenberg editor the post is being saved and uncheck the "Send notification on publish" box. This needs to be done in the Client side (Javascript), so we might need a subscribe to the isSavingPost or isAutosavingPost events like:
https://wholesomecode.ltd/blog/hook-save-action-wordpress-gutenberg/ https://wordpress.stackexchange.com/questions/319054/trigger-javascript-on-gutenberg-block-editor-save
Hi @rwngallego, I thought this was the issue, that's why I've proposed a temporary workaround that can easily be useful for other things: set a time limit, if another notification push for the same post is sent in this timeshift, the push is ignored.
Yeah, I understand. We can start by implementing the logic above first because that will fix the root cause. If necessary we can revisit the time limit again in the future. I consider that once we have the validation in the Gutenberg editor, it will not be possible to send consecutive push messages unless the user consciously marks the checkbox.
Hi, I also ran into this issue. Whenever I update a post, a new notification is sent. But I only want to send it on the initial publish.
Is there a workaround do disable the setting and do it with a php snippet instead? This is really bugging me, as we cannot use notifications like that.
Cheers Nico
You can reload the page after the publication and double check that the flag isn't flagged. In that way it won't push again
I see, there is a per-post setting which I did not see in the first place. Isnt there a way to fix this properly? This doesnt sound too complicated, or is it?
I also noticed that an update on a custom post type (astra theme hooks) will also trigger a push notification, which of course is not desired. We would need to disable that as well.