feat: handle user deletion event on the network#91
Conversation
chickenn00dle
left a comment
There was a problem hiding this comment.
Hey @adekbadek,
I'm running into issues testing this one. A couple things:
- When I delete the propagated user from a node, I see the delete event, but the user is never deleted from the hub site. Here is what I see on the node:

And once the event propagates, this is what I see on the hub:

But the user is never deleted on the hub:

- Might be related to the above, but when a user is deleted, I am also seeing the user updated event trigger (pictured in the screenshots above). I would expect this event not to be needed once a user is deleted. I wonder if this also has something to do with why the user persists on the hub even after the deletion event is processed?
chickenn00dle
left a comment
There was a problem hiding this comment.
Nice! This is working as expected now. I noticed some strangeness with the logs, but considering the primary functionality is working and deletions are ultimately being logged, I'm gonna go ahead and approve this.
| require_once ABSPATH . 'wp-admin/includes/user.php'; | ||
|
|
||
| // Don't broadcast this deletion on the network. | ||
| add_filter( 'newspack_network_process_user_deleted', '__return_false' ); |
There was a problem hiding this comment.
Just noting this results in conflicting messaging in the logs where the account is logged as skipped, but then is logged as deleted:
[25-Apr-2024 14:07:47 UTC] [3110] /Users/raz/Sites/newspack/network/includes/class-data-listeners.php:103 User deletion with email: raz+networksubscriber3@automattic.com was skipped due to filter use.
[25-Apr-2024 14:07:47 UTC] [3110] /Users/raz/Sites/newspack/network/includes/incoming-events/class-user-deleted.php:70 User raz+networksubscriber3@automattic.com deleted.
Since the final log indicates the deletion was successful, I think this is not a blocker.
# [1.7.0-alpha.1](v1.6.0...v1.7.0-alpha.1) (2024-04-25) ### Features * handle user deletion event on the network ([#91](#91)) ([cf3df3b](cf3df3b))
|
🎉 This PR is included in version 1.7.0-alpha.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
# [1.7.0](v1.6.0...v1.7.0) (2024-05-15) ### Features * handle user deletion event on the network ([#91](#91)) ([cf3df3b](cf3df3b))
|
🎉 This PR is included in version 1.7.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
All Submissions:
Changes proposed in this Pull Request:
Adds user deletion handling.
(Note: this is a part of integrating the changes from the
data-integrity-improvementsbranch (#89))How to test the changes in this Pull Request:
network_user_deletedevent in the event log* can be sped up by running
wp newspack-network process-webhookson the node and thenwp newspack-network sync-allon the other node sitesOther information: