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

Updated delete_user_action function to fix issues #268 and #312 #313

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

garretthyder
Copy link

I've updated the delete_user_action to correct two issues (#268 and #312).

To fix #268 I've pulled the coauthor_term to utilize it's term_id in the wp_delete_term so as to properly delete the author term. Previously was using the user_login which does nothing. To reproduce the original issue you can delete a coauthor through the user_delete mechanism, then if you add a user with the exact same username they'll show up again on the post as a coauthor. This fix fully removes the relation to the post.

To fix #312 I've updated the posts lookup from the broken sql statement to a get_posts using the tax_query. Previously delete user would only reassign if the deleted user was the primary author as they'd be set as post_author, any secondary authors were overlooked. Now by using the get_posts and tax_query we cover all bases and properly reassign ALL posts/cpt/etc. to the reassign user.

Thoughts/Feedback? Happy to discuss.
Cheers

@GaryJones
Copy link
Contributor

Only the last commit is relevant, though #792 was merged which fixed one of the issues as well.

@GaryJones GaryJones added this to the Future milestone Jul 27, 2023
@GaryJones GaryJones changed the base branch from main to develop August 25, 2023 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants