-
Notifications
You must be signed in to change notification settings - Fork 3
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
feat: handle user deletion event on the network #91
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: [email protected] 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 [email protected] 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-improvements
branch (#89))How to test the changes in this Pull Request:
network_user_deleted
event in the event log* can be sped up by running
wp newspack-network process-webhooks
on the node and thenwp newspack-network sync-all
on the other node sitesOther information: